home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-27 | 193.7 KB | 4,851 lines |
- Copyright ’ 1988-1994, Brains software, All Rights Reserved.
- $$Apple Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$About Asymptote$i$
- ± Display version, registration and copyright information
- $i$Help...$i$
- ± Access this on-line help system $b$help$b$
-
- ¥¥ For more information on the on-line help system, type
- help help
- in the $i$Command Window$i$
- $$File Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$New$i$
- ± Open a new Text Editor Window $b$newwindow$b$
- $i$Open...$i$
- ± Open an existing text file
- $i$Recorder$i$
- ± Specify which window is the recorder
- ¥ See also the topic: $i$Recorder menu$i$
- $i$Data$i$
- ± Specify which window is the data file $b$datafile$b$
- ¥ See also the topic: $i$Data menu$i$
- $i$Close$i$
- ± Close a window $b$closewindow$b$
- $i$Save$i$
- ± Save the contents of the active window to a disk file
- $i$Save As...$i$
- ± Save the contents of the active window under a
- different filename
- $i$Graph Page Setup...$i$
- ± Choose a new graph page setup $b$pagesetup$b$
- ¥ See also the topic: $i$Graph Page Setup menu$i$
- $i$Print Graph$i$
- ± Print the contents of the $i$Graph Window$i$ $b$print$b$
- $i$File Page Setup...$i$
- ± Change the page setup for a Text Editor Window
- $i$Print File$i$
- ± Print a Text Editor Window
- $i$Options$i$
- ± Change options for Asymptote
- ¥ See also the help topics: $i$Options menu$i$
- $i$Memory Use$i$
- $i$Preferences$i$
- $i$Search Paths$i$
- $i$Command Macros$i$
- $i$Quit$i$ $b$quit$b$
- ± Quit Asymptote
- $$Graph Page Setup
- sub-menu under the File Menu
- Menu Command Asymptote command
- $i$New Page Setup...$i$ $b$pagesetup ?$b$
- ± Choose a new graph page setup
- $i$Save to recorder$i$
- ± Save the current graph page setup to the Recorder
- $i$Read from recorder$i$
- ± Read the graph page setup from the Recorder $b$pagesetup$b$
- $$Options
- sub-menu under the File Menu
- Menu Command Asymptote command
- $i$Preferences...$i$
- ± Select your personal preferences see:$i$Preferences$i$
- $i$Memory Use$i$
- ± Configure how Asymptote uses memory see:$i$Memory Use$i$
- $i$Search Paths File...$i$
- ± Select a Search Paths File see:$i$Search Paths$i$
- $i$Command Macros$i$
- ± Select a command macros file see:$i$Command˚Macros$i$
- $$Preferences
- Menu Command on the Options sub-menu
- To make changes to your preferences simply check or uncheck the various items and
- click on the OK button. Asymptote remembers your preferences until you change
- them again.
-
- $b$Dialog and Alert Preferences$b$
- $i$Center dialog and alert boxes on screen$i$
- When you select this preference, Asymptote centers dialogs and alert boxes on your
- screen. If you have a large screen, you may find this preference particularly helpful.
- Deselect this preference if you want dialog and alert boxes to appear below the menu
- bar instead.
-
- $i$Show note alerts$i$
- From time to time Asymptote displays a note alert with non-essential information.
- If you donàt want to be bothered by these notes, deselect this preference. Turning
- off note alerts is particularly useful when running a script in the background because
- note alerts interrupt the execution of scripts.
-
- $i$Notify me when the Recorder stops playing in the background$i$
- Select this preference if you want Asymptote to tell you when it has finished running
- a script in the background. The notification message looks like this:
-
- Selecting this preference is a convenient way to have Asymptote notify you when it has
- finished drawing your graph while running in the background.
-
- $b$Script Preferences$b$
- $i$Execute the script Asymptote Startup when Asymptote starts$i$
- When you select this preference, Asymptote runs the script named Asymptote Startup
- every time it starts up. The Asymptote Startup script is a convenient way to configure
- Asymptote with your personal preferences for the variables of the
- $i$graphics environment$i$ such as pen size, font, and fill pattern every time Asymptote
- starts up. For more information on the $i$Startup script$i$ see Appendix A of
- the Asymptote $i$User's Guide$i$.
-
- $i$Clear the Graph Window before running the Recorder script$i$
- When you select this preference, Asymptote clears the $i$Graph Window$i$ every time you
- run the Recorder. If you deselect this preference, the new graph is drawn on top of the
- old graph every time you run the Recorder. If you are running the same script over and
- over again in order to make changes to your graph, you probably want to select this
- preference. If you are running several different scripts to draw multiple graphs on the
- same page, you probably want to deselect this preference. Remember, you can always
- use the clear command to clear the $i$Graph Window$i$ whenever you need a blank page.
-
- $i$Donàt update the Status and Vectors Windows$i$
- The $i$Status$i$ and $i$Vectors Windows$i$ are very useful tools for debugging your
- scripts. You can use them to monitor changes to the $i$graphics˚environment$i$ and the
- values in Asymptotes vectors. But updating these windows takes time and makes your
- scripts take longer to run. Once you have debugged your scripts, you probably want to
- select this preference to make your scripts run faster. Closing the $i$Status$i$ and $i$Vectors$i$
- Windows when you arenàt using them also makes your scripts run faster.
-
- ¥ Note: If you have selected this preference and want to have Asymptote update the
- $i$Status$i$ or $i$Vectors$i$ Windows while Asymptote is running a script, simply click
- the window to have Asymptote update its contents.
-
- $i$Trace the execution of scripts$i$
- This preference is useful when you are debugging your scripts because you can monitor
- how your scripts are running. When you select this preference, Asymptote scrolls
- through the text in your scripts to show you which line is currently being executed.
- Scrolling through the text and updating windows takes time, however, so if you want
- your scripts to run faster, deselect this preference.
-
- $i$Add new commands at the end of the Recorder$i$
- When you type commands in the Command Window or select commands from menus,
- Asymptote saves the command in the $i$Recorder Window$i$. When you select this preference,
- Asymptote saves new commands at the end of the current Recorder script. In this way,
- the $i$Recorder$i$ provides a history of all the commands you used to produce a graph.
- After youàve created a graph, you may want to add commands in the middle of your
- Recorder script to make changes in your graph. In this case, you may prefer to
- deselect this preference to have Asymptote insert new commands at the current position
- of the insertion point in your Recorder script. With this preference deselected, you can
- type commands in the Command Window or select commands from Asymptoteàs menus to
- have Asymptote insert them at the current insertion point in your Recorder script.
- ¥ Note: The order in which Asymptote executes commands is important. If you add
- commands in the middle of your Recorder script, be sure to run the Recorder from
- time to time to see if executing the commands in sequence produces the results you want.
-
- $b$Other Preferences$b$
- $i$Show the graph cursor information box in the Graph Window$i$
- When you issue commands that activate the graph cursor (for example, $b$moveto$b$ ? or
- $b$drawto$b$ ?) Asymptote activates the graph cursor. Select this preference if you
- want Asymptote to display information about the current position of the graph cursor
- in the $i$Graph Window$i$.
-
- $i$Show the names of directories being searched$i$
- Asymptote searches for files it needs to open using your Search Paths file. Select this
- preference if you want to view the progress of the search. You may find this useful if
- Asymptote is unable to locate a file and you want to know what directories it has searched.
- If youàd rather not be bothered with the details of the search, deselect this preference.
-
- $i$Ask to save the Graph Windowàs contents when it is closed$i$
- Select this preference if you want to save your graph to a PICT file every time you close
- the $i$Graph Window$i$. For most circumstances, you donàt need to save the graph because
- your Recorder script provides a complete record of how your graph was made. You can
- always run the Recorder to generate your graph again, but if you would like to have PICT
- versions of all your graphs, select this preference. When you select this preference,
- Asymptote asks you if you want to save the contents of the $i$Graph Window$i$ if you close
- the $i$Graph Window$i$ without saving the graph to a PICT file first. You may want to save
- your graphs to PICT files if you want to use them in other programs or if you are
- creating complicated graphics that take a long time to draw from a script.
-
- ¥ Note: You can save the current contents of the $i$Graph Window$i$ to a PICT file at anytime
- by clicking the $i$Graph Window$i$ and selecting File Save˚As.
-
- $i$Use the maximum printer resolution for the highest quality graphics$i$
- Select this preference if you want Asymptote to draw your graph on a high resolution
- coordinate grid. A high resolution grid (one with more dots per inch) produces the
- highest quality output on your printer. If you are creating graphs to use in another
- application, you may need to experiment with the setting of this preference. Most
- drawing and desktop publishing programs can handle the high resolution graphics
- Asymptote produces when you select this preference, but others cannot. If you have
- difficulty reading or pasting an Asymptote graph into another program, try
- deselecting this preference.
- $$Memory Use
- menu command on the Options sub-menu
- To configure how Asymptote uses memory, select the $i$Memory Use$i$ item from
- the $i$Options$i$ menu. A dialog box lets you choose what settings Asymptote should
- use the next time you launch it. Here you can select how long to make Asymptote's
- vectors and how many registers and stack elements you want. For a detailed description
- of the Memory Use dialog, see Chapter 3 of the Asymptote $i$User's Guide$i$.
-
- WOULD YOU LIKE TO PLOT MORE POINTS?
- Use the $i$Memory Use$i$ dialog box to lengthen Asymptote's x, y, p, or e vectors
- so you can plot more points. The next time Asymptote starts, it allocates
- additional memory for the increased size of the data arrays. If there isn't enough
- memory to accommodate the larger vectors, Asymptote makes them as long as
- possible.
-
- IS MEMORY LOW?
- If you find you are running low on memory try the following steps:
- ¥ Close windows you are not using and save their contents.
- ¥ On color Macintoshes, use the Monitors Control Panel to switch to 1 bit.
- ¥ Allocate more memory to Asymptote in the Finder as described in the section titled
- ¼Using Memory½ of the $i$User's Guide$i$.
- ¥ Select File>Options>Memory Use and reduce the number of registers you are using,
- or the depth of the vector calculator stack.
- Note: If the amount of free memory is getting low, Asymptote does not maintain a
- snapshot of the $i$Graph Window$i$. If this happens, the $i$Graph Window$i$ may take much
- longer to be drawn. Free up some memory to improve performance.
-
- ¥ Note: The $i$Status Window$i$ presents some useful information about your usage of memory.
- $$Search Paths
- menu command on the Options menu
- Asymptoteàs search paths lets you specify where Asymptote should look when it needs to
- open a script or a data file. You store these paths in a Search Paths File. When
- Asymptote needs to locate a file to open, it automatically searches the paths for you.
-
- To create a Search Paths File, type a set of search paths (one per line) into a Text Editor
- Window and save the file in the same directory as Asymptote. Then, select
- File>Options>Search Paths File which tells Asymptote to use the new file.
-
- You can change your search paths at any time by opening the Search Paths file in a
- Text Editor Window. If you have the current Search Paths file open in a Text Editor
- Window, Asymptote uses the edited copy (rather than the one on disk) for the
- search paths.
-
- When Asymptote needs to open a file, it first looks in the Asymptote folder or in
- the System Folder. If Asymptote canàt find the file, it uses the search paths in the
- current Search Paths File to locate the file. The Search Paths File is a list of places
- in which Asymptote looks for files. Each line of the Search Paths File is a possible
- ¾path nameà that identifies a particular file or group of files in your hard disk.
- You can define either full or partial path names. Full path names begin with the
- name of the disk to search. You can use them to locate a file on any disk in your
- Macintosh desktop. Partial path names, which begin with a colon, specify files or
- folders in the Asymptote folder.
-
- For example, if a file named ¾MyDataà is in a folder named ¾Testing,à which is in
- the same folder as Asymptote, the partial path name of the file would be the following:
- :Testing:MyData
- If the Asymptote folder were on a hard disk named ¾Smith,à the full path name to
- the same file might be something like this:
- Smith:Asymptote:Testing:MyData
-
- $b$Using Wild Cards in the Search Paths File$b$
- The above examples specified search paths that matched files exactly. To specify a
- search path that can locate any number of files in any number of directories, use
- the special characters, question mark (?) and asterisk (*). A question mark in a
- path name matches any single character. An asterisk matches any number of characters.
- For example, the search path
- Smith:Asymptote:Testing:MyData??
- matches any file in the folder Smith:Asymptote:Testing with the name MyData followed
- by any two characters. To locate files named MyData followed by any number of
- characters, you could use the search path
- Smith:Asymptote:Testing:MyData*
- or you could match any file in the directory Smith:Asymptote:Testing:MyData with
- the search path
- Smith:Asymptote:Testing:*
- Replace the name of a folder in a search path with a * to have Asymptote include
- that folder and all of the folders inside it in the search path. This gives you a
- powerful way to search whole directory trees for files. If you replace the disk
- name in a search path with an asterisk, Asymptote searches all the disks on the
- desktop. Here are some examples:
-
- Files with names ending in ¾.datà in the folder ¾My Data:Julyà on the disk ¾Data˚1à:
- Data 1:My Data:July:*.dat
- Files ending in ¾.datà in any folder inside the folder ¾My Dataà:
- Data 1:My Data:*:*.dat
- Files ending in ¾.datà in any folder on the disk ¾Data˚1à:
- Data 1:*:*.dat
- Any file ending in ¾.datà on any disk on the desktop.
- *:*.dat
- Files beginning with the letters ¾abcà in the Asymptote folder:
- :abc*
- Files beginning with the letters ¾absà in any folder in the Asymptote folder:
- :*:abc*
- All files in the Asymptote folder and all of the folders inside it:
- :*:*
- Files beginning with the letter ¾zà in any folder that has ¾xyà as its third
- and fourth characters followed by any number of characters:
- :??xy*:z*
- $$Command Macros File
- menu command on the Options sub-menu
- Command macros are powerful way to streamline and configure Asymptote to suit you
- and your needs. When Asymptote begins processing a new command, either when it
- reads the next line of a script or when you type a command in the $i$Command
- Window$i$, it first searches the Command Macros File to see if there is a macro
- with the given name. If a macro is found it replaces the macro name with macro
- definition leaving the rest of the command unchanged. If a macro is not found,
- Asymptote searches for a script with the same name as the command using the
- current search paths (see $i$Search Paths$i$).
-
- To choose the file you would like Asymptote to use for command macros, select the
- $i$Command Macros$i$ menu command from the $i$Options$i$ menu. Asymptote
- asks you to select the macros file and uses that file until you select a new one.
-
- WRITING COMMAND MACROS:
- A command macro must have the name of the macro as the first item in the line. The
- text of the macro should follow after that. The text of the line can contain arguments
- (&1, &2, &3, etc). For example, the following macro:
- stars pointsymbol 5 filled
- sets the point style to filled 5 pointed stars every time you type 'stars' in the
- $i$Command Window$i$ or whenever the command 'stars' is encountered in a
- script. Take a look at the file ¼Asymptote Macrosà for some examples.
-
- COMMAND MACROS AS ONE LINE SCRIPTS:
- Command macros can also accept arguments. For example the following macro in the
- command macros file:
- solidpts pointsymbol &1 filled
- sets the pointsymbol to filled squares if you type:
- solidpts 4
- in the Command Window or in another script. Its sets the point style to filled
- triangles if you use:
- solidpts 3
- instead. In this case the single argument to the macro ¾solidptsà is the number of
- sides of the point.
-
- USING COMMAND MACROS TO REDEFINE ASYMPTOTE COMMANDS:
- Another way to use command macros is to redefine Asymptote's commands to suit
- your tastes. You may not like the name of a particular command, you may want to
- shorten a command so it is easier to type, or you may want to customize Asymptote
- commands to look more like commands you are familiar with from other programs.
- For example, to redefine the graphlimits command to be 'gl' use the macro:
- gl graphlimits
- Then the command
- gl 1 10 -1 10
- has exactly the same effect as:
- graphlimits 1 10 -1 10
- and it is much shorter to type.
-
- ¥ Note: You can open and edit the Command Macros file while you are using
- Asymptote. As you make changes to the macros, Asymptote will use the new
- definitions when it executes a macro. There is no need to save the macros file and
- restart Asymptote (the same is true for the Search Paths file, but not for the Help file).
- $$Edit Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$Undo...$i$
- ± Undo the last change you made in a Text Editor Window
- $i$Cut...$i$
- ± Cut the selected text to the clipboard
- $i$Copy...$i$
- ± Copy the selected text to the clipboard
- or
- ± Copy the contents of the $i$Graph Window$i$ to the clipboard
- $i$Paste...$i$
- ± Paste the clipboard text at the insertion point
- $i$Clear...$i$
- ± Clear selected text
- or
- ± Clear the $i$Graph Window$i$ $b$clear$b$
- $i$Create Publisher$i$
- ± Create a new publisher of the $i$Graph Window$i$ $b$publish$b$
- $i$Subscribe To...$i$
- ± Open a text edition in a Text Editor Window $b$open$b$
- $i$Publisher/Subscriber Options...$i$
- ± Set the options for a publisher or subscriber
- $$Search
- sub-menu under the Edit Menu
- Menu Command
- Search Menu:$i$
- $i$Find...$i$
- ± Search from some text in one or more text files
- $i$Find Again$i$
- ± Find the next occurrence of the search text
- $i$Find in Next File$i$
- ± Open the next file and find the next occurrence of the search text
- $$Replace
- sub-menu under the Edit Menu
- Menu Command
- $i$Selection$i$
- ± Replace the selected text with the replacement text
- $i$and Find Again$i$
- ± Replace the selected text and search again
- $i$All$i$
- ± Replace all occurrences of the search text with the replacement text
- $$Go to
- sub-menu under the Edit Menu
- $i$Top$i$
- ± Move the insertion point to the first line of a Text Editor Window
- $i$Bottom$i$
- ± Move the insertion point to the last line of a Text Editor Window
- $i$Line #...$i$
- ± Move the insertion point to a specified line number in a Text Editor Window
- $$Indent
- sub-menu under the Edit Menu
- $i$Left$i$
- ± Indent the selected text to the left by one tab stop
- $i$Right$i$
- ± Indent the selected text to the right by one tab stop
- $$Configure
- sub-menu under the Edit Menu
- $i$Font$i$
- ± Choose a font for a Text Editor Window
- $i$Font Size$i$
- ± Choose a font size for a Text Editor Window
- $i$Tab width...$i$
- ± Choose the width for a Text Editor Window
- $i$Auto indent$i$
- ± Auto indent when you press the Return key
- $$Data Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$Lines...$i$
- ± Select which of the data file to use when reading data $b$datalines$b$
- $i$Columns...$i$
- ± Select the columns of the data file to read $b$datacolumns$b$
- $i$Read x data...$i$
- ± Read a row of the data file into the x vector $b$readrow$b$ x
- ± Read a column of the data file into then x vector $b$readcolumn$b$ x
- $i$Read y data...$i$
- ± Read a row of the data file into the y vector $b$readrow$b$ y
- ± Read a column of the data file into the y vector $b$readcolumn$b$ y
- $i$Read point styles...$i$
- ± Read a row of the data file into the p vector $b$readrow$b$ p
- ± Read a column of the data file into the p vector $b$readcolumn$b$ p
- $i$Read e data...$i$
- ± Read a row of the data file into the error vector $b$readrow$b$ e
- ± Read a column of the data file into the e vector $b$readcolumn$b$ e
- $i$Read labels...$i$
- ± Read a row of the data file into the l vector $b$readrow$b$ l
- ± Read a column of the data file into the l vector $b$readcolumn$b$ l
- $i$Sort by X$i$
- ± Sort all the vectors by the x vector $b$sort$b$
- $i$Calculate...$i$
- ± Activate the rpn calculator window $b$rpn$b$
- $i$Bin X...$i$
- ± Calculate the histogram of the values in the x vector $b$binxy$b$
- $i$Smooth Y...$i$
- ± Smooth the y data with a variable width window $b$smooth$b$
- $i$Spline Y = f(x)...$i$
- ± Fit a spline to the x,y data points $b$spline$b$
- $i$Fit Y = a + b*X...$i$
- ± Fit a polynomial to the x,y data $b$fit$b$
- $i$# of points...$i$
- ± Set the lengths of the x,y,e,p, l vectors $b$npts$b$
- $$Set Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$Graph$i$
- ± Set the x and y limits of the graph frame $b$graphlimits$b$
- ± Set the spacing of axis tick marks $b$graphticks$b$
- ± Set the position of the graph in the page $b$graphframe$b$
- ± Set the aspect ratio of the graph on the page $b$graphaspect$b$
- $i$Pen$i$
- ± Set the pen:
- size $b$pensize$b$
- color $b$pencolor$b$
- transfer mode $b$penmode$b$
- pattern $b$penpattern$b$
- dash pattern $b$pendash$b$
- $i$Background
- ± Choose a background color for the $i$Graph Window$i$ $b$backcolor$b$
- $i$Fill pattern$i$
- ± Set the fill pattern for points and polygons $b$fillpattern$b$
- $i$Point Symbol$i$
- ± Set the symbol to draw at each point $b$pointsymbol$b$
- $i$Point Size$i$
- ± Set default size for point symbols $b$pointsize$b$
- $i$Tick Size$i$
- ± Set the default size for major tick marks $b$ticksize$b$
- $i$Scale Factor$i$
- ± Set the scale factor for points, tick marks and text $b$scale$b$
- $i$Rotation$i$
- ± Set the rotation angle of the graphics environment $b$rotation$b$
- $i$Font$i$
- ± Change the font for the $i$Graph Window$i$ $b$fontname$b$
- $i$Font Size$i$
- ± Set the default size for labels $b$fontsize$b$
- $i$Text Mode$i$
- ± Set the transfer mode for text $b$textmode$b$
- $i$Notation$i$
- ± Set the notation format for labels and tick marks $b$notation$b$
- $i$Digits$i$
- ± Set how many digits to use for labels and ticks $b$digits$b$
- $i$Variable$i$
- ± Set or change the value of a variable $b$set$b$
- $$Plot Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$Clear...$i$
- ± Clear the graph $b$clear$b$
- $i$Zoom In/Out$i$
- ± Zoom the graph to show more or less detail $b$zoomgraph$b$
- $i$Show Graph$i$
- ± Zoom to show the graph frame $b$showgraph$b$
- $i$Show Page$i$
- ± Zoom to show the entire page $b$showpage$b$
- $i$Full Screen$i$
- ± Turn full screen mode on and off $b$fullscreen$b$
- $i$Cursor$i$
- ± Activate the graph cursor $b$cursor$b$
- $i$Points$i$
- ± Plot the x,y data as individual points $b$plotpoints$b$
- $i$Errors$i$
- ± Plot error bars on the x,y points $b$ploterrors$b$
- $i$Line$i$
- ± Plot the x,y data a line $b$plotline$b$
- $i$Arrows$i$
- ± Plot arrows between pairs of points $b$plotarrows$b$
- $i$Histogram$i$
- ± Plot the x,y data as a histogram $b$plothistogram$b$
- $i$Polygon$i$
- ± Connect the x,y points to make a polygon $b$plotpolygon$b$
- $i$Labels...$i$
- ± Plot labels at each of the x,y data points $b$plotlabels$b$
- $$Draw Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$Frame...$i$
- ± Draw a frame around the graph $b$drawframe$b$
- $i$Grid...$i$
- ± Draw grid lines $b$drawgrid$b$
- $i$Axis...$i$
- ± Draw an axis on one side of the graph frame $b$drawaxis$b$
- $i$Title...$i$
- ± Draw a title centered above the graph frame $b$drawtitle$b$
- $i$X Label...$i$
- ± Draw a label on the x axis of the graph $b$drawxlabel$b$
- $i$Y Label...$i$
- ± Draw a label on the y axis of the graph $b$drawylabel$b$
- $i$Label...$i$
- ± Draw a label at the current pen position $b$drawlabel$b$
- $i$Move to...$i$
- ± Move the pen to a new x,y location $b$moveto$b$
- $i$Draw to...$i$
- ± Draw a line from the current pen position to
- a new x,y position $b$drawto$b$
- $i$Arrow to...$i$
- ± Draw an arrow from the current pen position to
- a new x,y position $b$drawarrowto$b$
- $i$Point$i$
- ± Draw a point on the graph $b$drawpoint$b$
- $i$Clip To Frame$i$
- ± Select whether to allow drawing outsize the
- graph frame or not $b$cliptoframe$b$
- $$Window Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$Graph$i$
- ± Bring the $i$Graph Window$i$ to the top
- $i$Command$i$
- ± Bring the Command Window to the top
- $i$Calculator$i$
- ± Bring the RPN window to the top $b$rpn$b$
- $i$Vectors$i$
- ± Bring the vectors window to the top
- $i$Variables$i$
- ± Bring the variables window to the top
- $i$Status$i$
- ± Bring the status window to the top
- $i$Help$i$
- ± Bring this help window to the top $b$help$b$
-
- ¥ Use the other items on this menu to select a file in a Text Editor Window.
- $$Script Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$Run Recorder$i$
- ± Start executing the current $i$Recorder Window$i$ $b$run$b$
- $i$Run Active Window$i$
- ± Run the script in the active window
- $i$Run Selection$i$
- ± Run selected lines in the active window
- $i$Pause$i$
- ± Pause on the currently executing command $b$pause$b$
- $i$Step$i$
- ± Execute the next command in the current script
- $i$Stop$i$
- ± Stop running a script $b$stop$b$
- $i$Trace$i$
- ± Trace the execution of scripts as they execute $b$trace$b$
- $i$Trace$i$
- ± Trace the execution of scripts as they execute $b$trace$b$
- $i$Add Commands$i$
- ± Select whether to add commands at the end of the
- $i$Recorder Window$i$ or at the insertion point
- ¥ See also:$i$Preferences$i$
- $$Movie Menu
- Using Menu Commands
- Menu Command Asymptote command
- $i$New...$i$
- ± Create a new, empty movie in the $i$Movie Window$i$ $b$moviefile$b$
- $i$Open...$i$
- ± Open an existing movie file in the $i$Movie Window$i$ $b$moviefile$b$
- $i$Add Frame$i$
- ± Copy the $i$Graph Window$i$ to a new movie frame $b$movieframe$b$
- $i$Loop$i$
- ± Repeat the movie when it finishes playing
- $i$Loop Back and Forth$i$
- ± Reverse the movie when it finishes playing
- $i$Faster$i$
- ± Increase the speed of the movie
- $i$Slower$i$
- ± Decrease the speed of the movie
- $$Recorder Menu
- sub-menu under the File Menu
- Menu Command Asymptote command
- $i$New Recorder...$i$
- ± Open a new Text Editor and make it the Recorder
- $i$Open As Recorder...$i$
- ± Open an existing text file and make it the Recorder $b$recorder$b$
-
- To make a different window to be the recorder, simply select
- its name on this menu.
-
- ¥ The current $i$Recorder Window$i$ (if any) has a microphone
- icon next to its name.
-
- See also:$i$Recorder Window$i$
- $$Data
- sub-menu under the File Menu
- Menu Command Asymptote command
- $i$New Data...$i$
- ± Open a new window as the $i$Data Window$i$
- $i$Open As Data...$i$
- ± Open an existing text file and make it $b$datafile$b$
- the $i$Data Window$i$
-
- To make a different window to be the $i$Data Window$i$, simply
- select its name on this menu.
-
- ¥ The current $i$Data Window$i$ (if any) has an icon with the numbers
- 1,2,3 next to its name.
-
- See also:$i$Data Window$i$
- $$Recorder Window
- Asymptote Windows
- The Recorder is a special text editing window that logs all the commands you use
- to make your graph. As you work in Asymptote, whether you are selecting menu
- commands or typing commands, the $i$Recorder Window$i$ saves a record of what you have
- done. This record is a script that describes all the steps necessary to draw
- your graph. To run the script in the $i$Recorder Window$i$ select $i$Run˚Recorder$i$.
- When you have finished making a graph, save the $i$Recorder Window$i$ script to a file.
- You can run this script when you want to recreate the graph in the future.
- To plot different data or to fine tune the appearance of your graph, you can edit
- the script in the Recorder Window. To draw the revised graph select
- Script>Run˚Recorder. To learn more about writing scripts, turn to Chapter 6.
-
- Selecting the $i$Recorder Window$i$:
- You can identify the $i$Recorder Window$i$ by looking for the microphone symbol
- in the $i$Window menu$i$. Use the $i$Recorder Menu$i$ to make a different window the
- $i$Recorder Window$i$ or to open a new recorder. See the description of the $i$Recorder Menu$i$
- for more information.
- $$Data Window
- Asymptote Windows
- The $i$Data Window$i$ is the window Asymptote uses when reading data.
-
- The current $i$Data Window$i$, if one is open, is identified on the $i$Windows Menu$i$
- by a symbol with numbers 1,2,3 on it. To make a different window the $i$Data Window$i$,
- select its name from the $i$Data Menu$i$. You can also use the $i$Data$i$ menu to
- open a new Text Editor Window as the $i$Data Window$i$.
-
- SEE ALSO:
- $i$Reading Data$i$
- $b$datafile$b$
- $$Graph Window
- Asymptote Windows
- The $i$Graph Window$i$ is where Asymptote creates your graph.
-
- To zoom the graph to show more detail, move the mouse to the $i$Graph Window$i$, hold
- down the command key and click on the portion of the graph that you want to see in
- more detail.
-
- To zoom out, hold down the command and options keys together and click anywhere in
- the $i$Graph Window$i$.
-
- To print your graph select $i$Print Graph$i$ from the $i$File$i$ menu or type $b$print$b$ in the
- $i$Command Window$i$.
- $$Status Window
- Asymptote Windows
- The $i$Status Window$i$ keeps you informed about what Asymptote is doing, and provides
- valuable information about the state of your session with Asymptote. Use the
- $i$Status Window$i$ to check on the value of a variable in the $i$graphics environment$i$,
- to see which data file is open, or to check the value of a user variable. The
- $i$Status Window$i$ is particularly valuable when you are debugging a script (see
- Chapter 6). While you are executing a script in Asymptote, the title of the
- $i$Status Window$i$ changes to let you know the line number and the name of the script
- that is running.
-
- The items in the $i$Status Window$i$ are separated into groups. Most of these items
- are either variables in the $i$graphics environment$i$ or Asymptote variables. Variable
- names appear in the column on the right.
-
- SEE ALSO:
- $i$Variables & Constants$i$
- $i$graphics environment$i$
- $$Vectors Window
- Asymptote Windows
- Use the $i$Vectors Window$i$ to quickly the view the status of Asymptote's vectors.
-
- Click on the black triangles at the top of each column to select which vectors you
- want to view.
-
- Click on the scroll bar at the side of the $i$Vectors Window$i$ to scroll through the all the
- elements of the vectors you are viewing.
-
- The $i$Preferences$i$ dialog box allows you to suspend updates of the $i$Vectors Window$i$
- while your scripts are executing. This makes scripts run faster. When your script
- stops running or is paused Asymptote redraws the $i$Vectors Window$i$.
- $$Command Window
- Asymptote Windows
- Sometimes typing a command is faster than selecting menus and responding to dialog
- boxes. After you type a command in the $i$Command Window$i$ press Return or Enter.
- Asymptote executes the command and saves it to the current $i$Recorder Window$i$ (if one
- is open). To edit the command before you press Return, click the text with the mouse
- or press the left or right arrow keys.
-
- The up and down arrow keys have a special purpose in the $i$Command Window$i$. If you
- press the up arrow while the Command Window is active, Asymptote brings the
- current $i$Recorder Window$i$ to the front. Press the down arrow key while the
- $i$Recorder Window$i$ is active to bring the $i$Command Window$i$ to the front.
-
- Note that when you issue a command in the $i$Command Window$i$ using '?' for its
- arguments, Asymptote gets the values for the arguments from you interactively
- using dialog boxes or the graph cursor. It then records the command in the recorder
- window with the values 'filled-in'. This is a convenient way to enter a command if
- you don't remember what the arguments to the command are or if you don't
- remember their proper order.
-
- You can also use '?' to read coordinates from the graph. For example if you type:
- moveto ?
- in the $i$Command Window$i$, Asymptote activates the graph cursor, gets the new x,y
- position when you click the mouse, and then enters the $b$moveto$b$ command at the end of
- the recorder with the x,y coordinates filled in. If you clicked on (3.292,29.9) in
- graph coordinates, Asymptote enters the command:
- moveto 3.292 29.9
- in your recorder.
-
- If you always want to be prompted for the x,y coordinates for the moveto command
- every time your script executes, then put
- moveto ?
- directly into your script (don't type it in the $i$Command Window$i$). Every time
- Asymptote encounters this command it activates the cursor and gets the new x,y
- position from you using the mouse.
- $$Variables Window
- Asymptote Windows
- The $i$Variables Window$i$ is a list of all the variables and their current values. The
- variable name appears in the left column, while the right column contains the
- current value of the variable. As you create new variables they appear at the
- bottom of the list.
-
- To change a user variable use the $b$set$b$ command.
-
- SEE ALSO:
- $i$graphics environment$i$
- $i$Variables & Constants$i$
- $$Vectors Window
- Asymptote Windows
- Use the $i$Vectors Window$i$ to examine the contents of Asymptoteàs vectors. Click the
- black triangles at the top of each column to pop-up a menu. Use the pop-up menu to
- select the vector you want to view in each column.
-
- For convenience you can select Show Stack from the pop-up menu to have Asymptote
- display the current contents of the calculator stack. Showing the stack in the
- $i$Vectors Window$i$ is very useful when you are debugging $b$rpn$b$ calculations.
-
- SEE ALSO:
- $b$rpn$b$
- $i$Reading Data$i$
- $$Calculator Window
- Asymptote Windows
- You can write expressions for Asymptoteàs vector calculator with the
- $i$Calculator Window$i$. Simply click the various buttons in the calculator and Asymptote
- calculates the result. It also stores the appropriate $b$rpn$b$ command in your Recorder,
- giving you a complete record of your calculation which you can play back later.
-
- If you are not familiar with reverse polish notation, see Appendix˚D of the $i$Users Guide$i$.
-
- SEE ALSO:
- $b$rpn$b$
- $$Variables Window
- Asymptote Windows
- The $i$Variables Window$i$ is a list of all the variables with their current values.
- The variable name appears in the left column, while the right column contains the
- current value of the variable. As you create new user variables they appear at the
- bottom of the list. To change a user variable use the $b$set$b$ command.
-
- SEE ALSO:
- $i$Variables & Constants$i$
- $b$set$b$
- $$Movie Window
- Asymptote Windows
- The $i$Movie Window$i$ lets you view QuickTime movies. The controls at the bottom
- of the $i$Movie Window$i$ let you play a movie or step through its frames one at
- a time. See the description of the $i$Movie Menu$i$ for more information about
- playing movies
-
- SEE ALSO:
- $i$Movie Menu$i$
- $b$moviefile$b$ $b$movieframe$b$
- $$areaxy
-
- Calculate the area under the curve y = f(x)
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$areaxy$b$ to calculate the integrated area under the curve $i$y$i$= f($i$x$i$) using the
- trapezoidal rule. Asymptote stores the result in the user variable $i$area$i$.
-
- If you want to have more accuracy in the area calculation, consider first using $b$spline$b$
- to interpolate the curve with more ($i$x$i$, $i$y$i$) data points.
-
- Asymptote uses all the ($i$x$i$,$i$y$i$) data points to calculate the area. This means that points
- in the $i$x$i$ and $i$y$i$ arrays (including those outside your graph limits) will be used in
- the area calculation. If you don't want to include some of the ($i$x$i$,$i$y$i$) points in the area
- calculation, set their $i$y$i$ values to zero using the $b$rpn$b$ command as in the example below
-
- SEE ALSO:
- $b$spline$b$
-
- EXAMPLES:
- readcol y 3
- readcol x 2
- areaxy % find the area under to curve and store in $i$area$i$
- drawlabel left Area = \area % print the result on the graph
-
- % Find the area for X between 10 and 100:
- rpn <x 10 > <x 100 < + <y * >y % set y to zero if X < 10 or X > 100
- areaxy % calculate the area
- drawtitle Area for points with 10 < X < 100 = \area
- $$ask
- variableName trueText falseText query
- Ask the user for a true or false response and store the result in a user variable
-
- ARGUMENTS:
- variableName ± the name of a user variable to set
- trueText ± text for the true (result = 1) button
- falseText ± text for the false (result = 0) button
- query ± the question to ask
-
- DESCRIPTION:
- Use $b$ask$b$ to display a dialog box that asks a yes/no (true/false) question. Asymptote
- stores the response to the question in a user variable. You might use $b$ask$b$ to control
- the execution of a script by asking a plain English question such as ¼Do you want to plot
- another data file½ or ¼Plot the best fit model on top of the data?½.
-
- You can also use the $b$ask$b$ to have Asymptote display a dialog box that has only a single
- button response. You might use such a dialog box to alert the user to some condition or
- provide them with some information while a script is running. To hide one of the buttons,
- specify " " for its name. If you hide one of the buttons, the other button is made the
- default response. You can't hide both buttons. Here's and example of using the $b$ask$
- command to display a one button dialog that lets the user know what to do when the graph
- cursor is activated with the 'moveto ?' command that follows.
- ask OK " " Please click on the point with the graph cursor.
- moveto ?
-
- SEE ALSO:
- $b$set$b$
- $b$if$b$ $b$repeat$b$ $b$while$b$
-
- EXAMPLES:
- set continue true % set the default response to ¾trueà (1)
- ask continue Yes No Do you want to continue?
- if continue false = then stop
-
- set PlotOnTop true
- ask PlotOnTop "On Top" "Erase first" Plot the next curve on top of the last?
- if PlotOnTop false = then clear else plotline
-
- set DoQuit false
- ask DoQuit "Yes, exit to finder" "No, don't quit" Would you like to quit?
- if DoQuit then quit
-
- ask Normalize "Normalize Y" No Normalize the y data to its maximum?
- if Normalize then rpn <y max / >y
- $$backcolor
- r g b OR colorName
- Set the background color of the $i$Graph Window$i$
-
- ARGUMENTS:
- r, g, b ± red green blue color values in percent (0 to 100)
- or
- colorName ± the name of a color (red, green, blue, magenta,
- yellow, purple, black, white)
-
- DESCRIPTION:
- Use $b$backcolor$b$ to change the background color of the $i$Graph Window$i$. The $b$backcolor$b$
- command is especially useful when you are taking pictures of the screen or when you
- are making a presentation. You can use$b$backcolor$b$ to choose the background color
- and then $b$fullscreen$b$to expand the $i$Graph Window$i$ to fill the screen.
-
- To choose a color interactively type
- backcolor ?
- in the $i$Command Window$i$.
-
- SEE ALSO:
- $b$fullscreen$b$
-
- EXAMPLES:
- backcolor 80 80 80 % set the background color to light gray
- pencolor black
- drawframe % draw a black frame on the gray background
-
- backcolor black % set the background color to back
- pencolor white % set the pen color to white
- myscript % run my script and draw a white graph on black
- fullscreen on % expand the graph to fill the screen
-
- backcolor 10 90 25 % set the background to a particular color
-
- backcolor ? % Choose a color using a color wheel. Put this command
- % in a script to open the color wheel each time you run
- % the script.
- % Type this command in the $i$Command Window$i$, select the
- % color from a color wheel and Asymptote records the
- % appropriate backcolor command for you in the Recorder.
- $$binxy
- nbins [ operation [ xstart xend ] ]
- Bin the x, y data into equally spaced bins
-
- ARGUMENTS:
- nbins ± number of bins to calculate
- operation ± the operation to perform for each bin:
- count (=0) => count the number of points in each bin
- average(=1) => average the $i$y$i$ values that fall in each bin
- sum (=2) => sum the $i$y$i$ values that fall in each bin
- xstart ± x value for the start of the first bin
- xend ± x value for the end of the last bin
-
- DESCRIPTION:
- Use $b$binxy$b$ to calculate the histogram of the $i$y$i$ data values. Although $b$binxy$b$ accepts up to
- four arguments, you must supply on the first argument (nbins), the number of bins to
- calculate. The second argument, is the operation to perform on each bin (operation),
- and the third and fourth arguments are the smallest and largest $i$x$i$ values you want
- binned (xstart, xend).
-
- If you don't specify the operation, Asymptote simply counts the number of points that
- fall into each bin (for example a frequency distribution). If you donàt specify xstart
- and xend, $b$binxy$b$ uses the current graph limits (xleft and xright) for xstart and
- xend (see $b$graphlimits$b$).
-
- When $b$binxy$b$ executes, it goes through the ($i$x$i$, $i$y$i$) data points one by one. First it
- uses the $i$x$i$ value of the point to determine what bin needs to be modified. Then, $b$binxy$b$
- uses the $i$y$i$ value of the point to update the value in the bin. What Asymptote calculates
- depends on the operation you specify. If the operation is 'count' (=0) Asymptote simply
- counts the number of points that fall into each bin. For 'average' (=1) and 'sum' (=2)
- Asymptote calculates the average or sum of the points that fall in each bin. After all the
- ($i$x$i$,$i$y$i$) points have been processed, Asymptote replaces the $i$x$i$ values with the $i$x$i$
- values of the bin centers, stores the bin values in the $i$y$i$ vector and sets the number
- of points to the number of bins. Although you can use any plot command to plot the bin
- values, $b$plothistogram$b$ produces a skyline-like plot that reflects the fact that the
- data have been binned.
-
- Remember that $b$binxy$b$ uses both the $i$x$i$ and $i$y$i$ values when you specify ¾averageà and
- ¾sum.à If you want to calculate a sum or average histogram for the $i$x$i$ values only,
- use $b$rpn$b$ to copy the $i$x$i$ vector into the $i$y$i$ vector before you use $b$binxy$b$ to calculate
- the histogram (see the example below).
-
- SEE ALSO:
- $b$plothistogram$b$
- $b$graphlimits$b$
-
- EXAMPLES:
- readcol x 4
- readcol y 5
- graphlimits % Set the limits to show all points
- binxy 100 sum % Sum the y values of the points in to 100 bins in x
- graphlimits % Set the limits to show all bins
- plothistogram % plot the bins as a histogram
-
- binxy 50 count 10.2 12.3 % Count the number of x values that fall into
- % 50 bins ranging from 10.2 to 12.3 in x
-
- binxy ? % Ask for the bin parameters interactively
- $$clear
-
- Clear the graph and release the memory it occupies
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- When you select $b$clear$b$, Asymptote erases the $i$Graph Window$i$ and frees the memory
- used by the graph.
-
- If you like, you can use File>Options>Preferences to have Asymptote erase the graph
- automatically whenever you run the script in the $i$Recorder Window$i$.
-
- SEE ALSO:
- $i$Preferences$i$
- $$cliptoframe
- [ value ]
- Choose whether to clip drawing to the graph frame or not
-
- ARGUMENTS:
- value ± if $i$true$i$ then clip drawing to the graph frame
- else allow drawing outside the frame
-
- DESCRIPTION:
- Use $b$cliptoframe$b$ to control whether Asymptote clips (truncates) all drawing to the
- interior of the graph frame. Set $b$cliptoframe$b$ to false if you want lines, labels and
- points to extend outside the graph frame. If you donàt specify the single argument to
- $b$cliptoframe$b$, Asymptote sets $b$cliptoframe$b$ to true.
-
- Most of the time you will want to have $b$cliptoframe$b$ set to true. If you want to
- annotate your graph with labels or arrows that extend outside the frame, set
- $b$cliptoframe$b$ to false then draw your annotations (see the example below).
-
- SEE ALSO:
- $i$Preferences$i$
-
- EXAMPLES:
- cliptoframe false % donàt clip all subsequent drawing to the frame
-
- cliptoframe % set clip to frame to true
- plotline % plot a line which is clipped to the frame limits
- moveto xright 10 + ytop 10 + % move to a position just outside the frame
- cliptoframe false % make it possible to draw outside the frame
- drawlabel centerright This is an interesting point!
- moveto xright 10 + ytop 10 + % move the pen in front of the label
- drawarrowto x(10) y(10) % draw an arrow pointing to the 10th point
- $$closewindow
- [ windowname ]
- Close a window and release the memory it occupies
-
- ARGUMENTS:
- windowname ± the name of the window to close
-
- DESCRIPTION:
- Use $b$closewindow$b$ in a script to close a window when it is no longer needed. If you
- donàt supply the name of the window to close, Asymptote closes the currently running
- script.
-
- Closing windows frees up memory and reduces screen clutter. With $b$closewindow$b$,
- your scripts can close windows automatically when they are no longer needed. For
- example, you might write a script that opens a large file in the $i$Data Window$i$, reads
- values from the file into the $i$x$i$ and $i$y$i$ vectors, then closes the $i$Data Window$i$
- to free up the memory it occupies.
-
- You can also put $b$closewindow$b$ at the end of a script to close it automatically after it
- finishes running. This is particularly useful at the end of the ¾Asymptote Startup Scriptà
- or in any script that performs a task and is no longer needed.
-
- ¥ Note: If you want to hide a window on screen but keep its contents loaded in memory,
- use $b$hidewindow$b$ rather than $b$closewindow$b$. A hidden window still appears in the
- Windows menu where you can select its name and make it visible again. See
- $b$hidewindow$b$ for more details.
-
- SEE ALSO:
- $i$Startup Script$i$
- $b$hidewindow$b$ $b$showwindow$b$
-
- EXAMPLES:
- close March1988 data % close the window "March 1988 data"
-
- close \f % close the current data file
-
- close % close this window
- $$cursor
-
- Activate the graph cursor and read values from the graph
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$cursor$b$ to activate the $i$Graph Window$i$ cursor and read information from your
- graph. Asymptote activates the $i$Graph Window$i$ and draws cross-hairs attached to the
- cursor. As you move the mouse Asymptote displays the current cursor position and the
- difference between that position and the current position of the pen. Click the mouse to
- make the cursor disappear.
-
- Note that $b$cursor$b$ does not move the pen. Use the $b$moveto$b$ command if you
- want to use the graph cursor to move the pen.
-
- SEE ALSO:
- $b$moveto$b$
- $$datacolumns
- [ startcolumn [ endcolumn ] ]
- Specify what columns or characters to read from the data file
-
- ARGUMENTS:
- startcolumn ± first column or character to read from each line
- endcolumn ± last column or character to read from each line
-
- DESCRIPTION:
- To specify the which columns you want to read from your data file, use the
- $b$datacolumns$b$ command. After you specify which columns of your data file you
- want to read, use $b$readcolumn$b$ or $b$readrow$b$ to actually read the data into
- Asymptoteàs vectors.
-
- To read data from all columns of your data file, execute $b$datacolumns$b$ with no
- arguments. If you specify the first argument, startcolumn, Asymptote reads from that
- column to the last column in each row of your data file. To specify both the starting and
- ending columns to read, supply both arguments to the $b$datacolumns$b$ command.
-
- The two ways to use $b$datacolumns$b$ are described below:
-
- READING FROM ROWS :
-
- When you are using $b$readrow$b$ to read your data, the $b$datacolumns$b$ command tells
- Asymptote which columns of the data file to read. Asymptote looks for any number of
- white space characters (spaces or tabs) to identify separate columns in your data file.
-
- For example, if row 10 of the data file looked like this:
- 123.2 12E34 23 45.6 34 99.202 -20.083 "a label"
- And you wanted to read the values
- 23 45.6 34
- from the 3rd, 4th and 5th columns into the $i$y$i$ vector, you would issue these commands:
- datacolumns 3 5 % select columns 3 through 5 inclusive
- readrow y 10 % read the three values from row 10 and store them in y
-
- READING FROM COLUMNS:
-
- When used in conjunction with the $b$readcolumn$b$ command, the $b$datacolumns$b$
- command tells Asymptote which $i$characters$i$ of each line to use when reading data.
- Normally the columns of your data file will be separated by spaces or tabs and it will not
- be necessary to use $b$datacolumns$b$ when reading from columns of a file. If the values
- in your data file are run together without spaces or tabs to separate them, use
- $b$datacolumns$b$ to identify which characters of each line you want to read.
-
- For example, if a portion of your data file looked like this:
- FREQ=12.25E+13 TEMP=125 RIN=98 514.2
- FREQ=12.29E+13 TEMP=116 RIN=89 746.4
- FREQ=12.33E+13 TEMP=137 RIN=56 982.2
- And you wanted to read the values
- 125 116 and 137
- which appear in characters 20 through 22 of each line, issue the commands:
- datacolumns 20 22 % tell Asymptote to ignore all but characters
- % 20 through 12 of each line
-
- readcolumn y 1 % read the first value (starting at character 10)
- % into the e vector
-
- Notice that this example uses 1 for the column number for the $b$readcolumn$b$
- command. This is because when you use $b$datacolumns$b$ to specify which
- $i$characters$i$ to use in each line, Asymptote $i$ignores all the other characters in the
- line$i$. Asymptote sees each line as beginning and ending with the characters you specify
- in the $b$datacolumns$b$ command. Therefore, you can use the $b$datacolumns$b$
- command to mask out all but the characters you want to read.
-
- Note: To help you count characters in a line, use Edit>Configure to select a monospaced
- font (for example, Courier or Monaco) rather than a proportionally spaced font for your
- data file. When you use a mono-spaced font, the characters in each line are the same
- width making them easier to count.
-
- SEE ALSO:
- $b$datalines$b$ $b$datafile$b$
- $b$readcolumn$b$ $b$readrow$b$
-
- EXAMPLES:
- datacolumns 3 20 % use columns 3 through 20
- readrow x 10 % read the values in columns 3 though 20 of line 10
- % into the x vector.
-
- datalines 1 13 % read from lines 1 through 13
- datacolumns 10 34 % ignore all but characters 10 through 34 of each line
- readcolumn x 2 % read the 2nd item starting with character 10 of each line
- % and store in x
-
- datacolumns 4 % Skip the first 3 columns and read to the end of each line
-
- datacolumns % use all columns (or characters) when reading data.
- % same as ¼datacolumns 0 0½
- $$datafile
- filename
- Open a data file with the name you specify
-
- ARGUMENTS:
- filename ± the name of the data file
-
- DESCRIPTION:
- Use $b$datafile$b$ to specify the data file Asymptote should use when it reads data with
- the $b$readrow$b$ and $b$readcolumn$b$ commands. If the data file you specify isnàt already
- open in a Text Editor Window, Asymptote searches for it automatically using the
- $i$Search paths$i$ file.
-
- DATA FILE FORMATS:
- Asymptote reads data from unformatted (ASCII) text files. You can read numbers or
- labels from either rows or columns of the file. Data files are easiest to read if the
- items in each line are separated by white space characters (any number of spaces
- or tabs) or a single comma. You can also skip over lines or columns in your data file
- and you can read data from files that donàt have the items on a line separated from
- one another. For a complete description of how to read data, see $i$Reading Data$i$ in
- Chapter 3 or type
- help Reading data
- in the $i$Command Window$i$.
-
- USING THE SEARCH PATHS FILE TO OPEN YOUR DATA FILE AUTOMATICALLY:
- If you have difficulty getting Asymptote to locate a file for you automatically, make sure
- youàve properly specified a search path to the file in your Search Paths file. Also, check
- to make sure you have spelled the name of the file correctly (including spaces). For
- help specifying search paths, see $i$Search Paths$i$ or type
- help Search Paths
- in the $i$Command Window$i$.
-
- SPECIFYING THE FULL OR PARTIAL PATH NAME OF YOUR DATA FILE:
- It is best to let Asymptote locate files for you automatically by including the path to your
- file in the Search Paths file. Locating files this way has the advantage that if you move
- your files to a different location, you need only change your Search Paths file to have
- Asymptote locate them automatically. It is possible, however, to specify the location of a
- file completely when you issue the $b$datafile$b$ command. The complete description of
- a fileàs location is called the ¼full path name.½ Full path names start with a disk name
- (usually your hard disk name) followed by the name of each subfolder (separated by
- colons) and the filename. For example, to locate the file "xyz" in the folder "March 12"
- which is on the hard disk named "My Disk" use
- datafile My disk:March 12:xyz
- Itàs also possible to give a ¼partial path name½ if the file you want is in the Asymptote
- folder or in some folder within the Asymptote directory. For example, if the folder
- "March 12" were in the same folder with Asymptote, you could use the partial path name:
- datafile :March 12:xyz
- Notice that partial path names begin with a colon, while full path names do not. Partial
- path names always start their search with the same folder as Asymptote.
-
- OPENING A SEQUENCE OF FILES BY NUMBER:
- If you have a sequence of data files to plot, you can plot them automatically by including a
- user variable in the filename. For example, suppose you have a series of files named,
- ¼Run 1 Raw Data½, ¼Run 2 Raw Data½, ¼Run 3 Raw Data½. First, create a script called
- ¼plotraw½ that looks like this:
-
- clear % clear the $i$Graph Window$i$
- datafile Run \i Raw Data
- readcolumn x 1
- readcolumn y 2
- % create the plot with more commands here...
- print % print the graph
-
- Notice that the $b$datafile$b$ command in this script inserts the user variable $i$i$i$ into
- the filename. Next, create a short script that increments $i$i$i$ while running the ¼plotraw½
- script:
-
- for i from 1 to 3 do plotraw
-
- When you insert a user variable in a filename, precede the name with a \ (backslash)
- and follow it with a single space. Asymptote removes the backslash and the space and
- substitutes the variable. Asymptote uses the settings of $b$notation$b$ and $b$digits$b$ to
- convert the numerical value of the variable to text.
-
- SEE ALSO:
- $i$Reading data$i$
- $i$Search Paths$i$
- $i$Window menu$i$
- $b$datalines$b$ $b$datacolumns$b$
- $b$readcolumn$b$ $b$readrow$b$
-
- EXAMPLES:
- datafile june data % open the file "june data"
-
- datafile :march 1988:run1 % open "run1" in the folder "march 1988"
-
- datafile ? % open a file interactively via a dialog box
-
- set counter 3
- datafile test #\counter data % open the data file ¾test #3 dataà
- datafile test\counter -new % open the data file ¾test3-newà
- $$datalines
- [ startline [ endline ] ]
- Specify what lines of the data file to use when reading data
-
- ARGUMENTS:
- startline ± staring line number to use when reading data
- endline ± last line (inclusive) to use when reading data
-
- DESCRIPTION:
- Use the $b$datalines$b$ command to tell Asymptote which lines of the data file you want
- to use when reading data. You can use $b$datalines$b$ to skip over header lines at the
- beginning of your data file or to read a particular set of lines rather than all of the
- lines in a file.
-
- To read every line from the data file, issue $b$datalines$b$ with no arguments. To skip
- over lines at the beginning of your data file (a header for example), specify only the
- first argument, $i$startline$i$, when you issue the $b$datalines$b$ command. Specify both
- startline and endline if you want to read specific lines from your data file.
-
- ¥ Note If you don't want to count lines in the data file, select the lines you want to read
- and type
- datalines ?
- in the $i$Command Window$i$ or select $i$Lines$i$ from the $i$Data menu$i$.
- Asymptote prompts you with the $b$datalines$b$ dialog box, and enters the lines you
- selected as the default starting and ending lines. Another way to determine the line
- number of a particular line is to click that line and select Edit>Go˚To˚Line Asymptote
- displays the line number you clicked as the default choice in the ¼Go To Line½ dialog box.
-
- SEE ALSO:
- $b$datafile$b$ $b$datacolumns$b$
- $b$readcolumn$b$ $b$readrow$b$
- $i$Go to Line #...$i$
-
- EXAMPLES:
- datalines 10 23 % use lines 10 through 23 when reading data
- datalines % use all lines in the data file
- % same as ¼datalines 0 0½
-
- datalines ? % to choose the data lines interactively
- $$digits
- [ n ]
- Set the number of digits to display when converting numbers to labels
-
- ARGUMENTS:
- n ± number of digits to display when converting numbers to labels
-
- DESCRIPTION:
- Use $b$digits$b$ to specify how many significant digits you want Asymptote to display
- when it converts numbers into labels. To decide how to convert numbers into text,
- Asymptote uses the number of digits you specify and the $b$notation$b$ you have chosen.
- For most notation formats, $b$digits$b$ selects the number of significant digits you want
- to display in the number. Use $b$digits$b$ = 0 to show all the digits in a number. For the
- 'decimal' notation ($b$notation$b$ = -2), $b$digits$b$ specifies how many digits to show
- $i$after$i$ the decimal point. With 'decimal' notation set $b$digits$b$ to a large number
- (say >10) if you want Asymptote to show all the digits in the number.
-
- The following examples show how Asymptote converts the value 123.456789 to a label
- using a variety of notation formats.
-
- $b$notation$b$ $b$digits$b$ Label
- decimal 4 123.4568
- 2 123.46
- 0 123
- For the ¾decimalà notation, $b$digits$b$ is the number of digits to display after the decimal
- point. If the value is 0, the ¾decimalà notation displays ¼0.0½ unless $b$digits$b$ is 0, in
- which case a ¼0½ with no decimal point is displayed.
-
- $b$notation$b$ $b$digits$b$ Label
- float 4 123.5
- 2 123
- 0 123.456789
- For the ¾floatà notation, $b$digits$b$ is the number of significant digits to display. The
- float notation always displays ¼0½ if the value is 0.
-
- $b$notation$b$ $b$digits$b$ Label
- general 4 123.5
- 2 123
- 0 123.456789
- The ¾generalà format uses ¾scientificà notation if the value is greater than 1˚x10^6,
- otherwise the ¾floatà notation is used. The general notation always displays ¼0½ if the
- value is 0.
-
- The ¾defaultà notation always uses scientific notation:
- $b$notation$b$ $b$digits$b$ Label
- default 4 1.235˚x˚10^2
- 2 1.2˚x˚10^2
- 0 1.23456789˚x˚10^2
- For the ¾defaultà notation, $b$digits$b$ is the number of significant digits in the mantissa.
- The default notation always displays ¼0½ if the value is 0.
-
- The ¾scientificà notation uses scientific notation:
- $b$notation$b$ $b$digits$b$ Label
- scientific 4 1.235˚x˚10^2
- 2 1.2˚x˚10^2
- 0 1.23456789˚x˚10^2
- For the ¾scientificà notation, $b$digits$b$ is the number of significant digits in the mantissa.
- If the value is 0 and $b$digits$b$is 0, ¾scientificà notation displays ¼0½, otherwise
- ¼0.0½ is displayed.
-
- The ¾hhmmssà notation displays hour, minutes and seconds:
- $b$notation$b$ $b$digits$b$ Label
- hhmmss 4 123h 27m 24.4s
- 2 123h 27m
- 0 123h 27m 24s
- For the ¾hhmmssà notation, if $b$digits$b$ is 0, the time is displayed with no decimal
- point in the seconds portion. If $b$digits$b$ is 1, only the hours are displayed. If
- $b$digits$b$ is 2, the hours and minutes are displayed. If $b$digits$b$ is >3, $b$digits$b$ - 3
- is the number digits to display after the decimal point in the seconds portion
- of the label. If the value is 0, ¼0h½ is always displayed.
-
- The ¾ddmmssà notation displays degrees, minutes and seconds:
- $b$notation$b$ $b$digits$b$ Label
- ddmmss 4 123¡27à 24.4àà
- 2 123¡ 27à
- 0 123¡ 27à 24àà
- For the ¾ddmmss notation, if $b$digits$b$ is 0, the angle is displayed with no decimal
- points in the seconds portion. If $b$digits$b$ is 1, only the degrees are displayed. If
- $b$digits$b$ is 2, the degrees and minutes are displayed. If $b$digits$b$ is >3, $b$digits$b$ - 3
- is the number digits to display after the decimal point in the seconds portion
- of the label. If the value is 0, ¼0¡½ is always displayed.
-
- SEE ALSO:
- $b$notation$b$
- $b$drawlabel$b$
- $b$drawtitle$b$ $b$drawxlabel$b$ $b$drawylabel$b$ $b$drawlabel$b$
-
- EXAMPLES:
- digits ?How many digits should I show in the label?
- set temp 1.23456789
- moveto ?
- notation general
- drawlabel temp = \temp
-
- digits 2
- set temp y(10) % use a variable to hold the value of the 10th y point
- drawlabel belowleft Y value of point #10 = \temp
- $$drawarrowto
- x y
- Draw an arrow from the current pen position to (x, y)
-
- ARGUMENTS:
- x ± x position at the end of the arrow
- y ± y position at the end of the arrow
-
- DESCRIPTION:
- Use $b$drawarrowto$b$ to draw a line from the current pen location to the coordinates you
- specify. Asymptote caps the line with an arrowhead. Asymptote uses the current pen
- properties when you draw arrows. Use any of the commands like $b$pensize$b$ and
- $b$pendash$b$ to change the appearance of the line (see $i$graphics˚environment$i$).
- You can change the size of the arrowhead with the $b$scale$b$ command.
-
- A convenient way to add a arrow to your graph is to use a question mark following the
- $b$drawarrowto$b$ command. Type
- drawarrowto ?
- in the $i$Command Window$i$ or in a script. Asymptote activates the graph cursor. When you
- click, Asymptote draws an arrow that points to the location you clicked.
-
- Remember, to draw arrows that extend outside the graph frame, set $b$cliptoframe$b$ to
- false before you use $b$drawarrow$b$. otherwise, Asymptote truncates your line if it
- extends outside the frame.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$moveto$b$ $b$drawto$b$ $b$cursor$b$
- $b$pensize$b$ $b$pendash$b$ $b$penpattern$b$ $b$pencolor$b$
- $b$scale$b$
- $b$cliptoframe$b$
-
- EXAMPLES:
- drawarrowto 3.4 56.9 % draw arrow from current (x, y) to (3.4 56.9)
- drawarrowto ? % choose x, y using the cursor
-
- pencolor red
- pendash short
- drawarrow 4 y 10 + % draw a red, dashed arrow to (4,y+10)
-
- drawarrowto x(5) y(5) % draw a arrow to the 5th data point.
-
- $$drawaxis
- axis[tickpos[labelpos[drawline[drawticks[drawlabels]]]]]
- Draw an axis on one side of the graph frame
-
- ARGUMENTS:
- axis ± selects which axis to draw
- bottom (=1)
- left (=2)
- top (=3)
- right (=4)
- tickpos ± selects whether to draw the tick marks inside or outside the graph frame
- inside (=1)
- outside (=2)
- labelpos ± selects whether to draw the tick mark labels inside or outside the frame
- inside (=1)
- outside (=2)
- drawline ± selects whether to draw the axis line or not
- noline (=0)
- line (=1)
- drawticks ± selects whether ticks should point inside or outside the graph
- noticks (=0)
- inside (=1)
- outside (=2)
- drawlabels ± selects whether to draw tick labels parallel or perpendicular to the axis
- nolabels (=0)
- parallel (=1)
- perpendicular (=2)
-
- DESCRIPTION:
- Use $b$drawaxis$b$ to draw individual axes on your graph. Although the $b$drawframe$b$
- command is a convenient way to draw axes on your graph, there are times youàll
- need to have more control drawing axes. That's when the $b$drawaxis$b$ command
- is useful.
-
- The first argument to $b$drawaxis$b$ specifies which axis to draw. Specify either the top,
- bottom, left or right axis of the frame. You must supply the first argument to
- $b$drawaxis$b$, all the other arguments are optional. The second argument lest you
- specify whether or not you want Asymptote to draw the axis line. This is useful if you
- are drawing an axis line in a different style or color that is different from the tick marks.
- Finally, the third and fourth arguments to $b$drawaxis$b$specify how tick marks and
- tick mark labels, if any, are drawn.
-
- Asymptote uses the variables of the $i$graphics environment$i$ to draw the axis. Before
- you issue the $b$drawaxis$b$ command, make sure you set the following variables:
-
- TO: USE:
- Set starting or ending values of the axis $b$graphlimits$b$
- Set the major and minor tick mark spacing $b$graphticks$b$
- Set the position the graph frame $b$graphframe$b$
- Set the line size or color of the axis $b$pensize$b$,
- $b$pencolor$b$, etc.
- Set the size of tick marks and tick labels $b$scale$b$
- Set the default size for tick marks $b$ticksize$b$
- Set the default size for tick labels $b$fontsize$b$
- Set the notation for tick labels $b$notation$b$
- Set the font for tick labels $b$fontname$b$
-
- Remember you can issue the $b$drawaxis$b$ command more than once to draw an axis.
- For example, you might call $b$drawaxis$b$ to draw thin tick marks then call
- $b$drawaxis$b$ again to draw a thicker axis line. You could accomplish this with the
- following commands:
-
- pensize 0.25 % set up for very thin tick marks
- % draw just the ticks and labels:
- drawaxis bottom inside outside noline inside parallel
- pensize 2 % set up for a thick axis line
- % draw just the axis line:
- drawaxis bottom inside outside line noticks nolabel
-
- To draw tick marks in a different color than the axis line, change the pen color between
- the two calls to drawaxis with $b$pencolor$b$.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$graphticks$b$
- $b$graphframe$b$
- $b$graphlimits$b$
- $b$notation$b$ $b$scale$b$ $b$fontname$b$
- $b$ticksize$b$ $b$ticksize$b$
- $b$pensize$b$ $b$pendash$b$ $b$pencolor$b$
-
- EXAMPLES:
- % Draw a basic frame:
- pensize .25 % Draw thick lines
- fontname Times % Choose the Times font for tick labels
- graphlimits 1.2 34 0 0 % x axis goes from 1.2 to 34 but
- % choose y limits based on max, min of
- % the current y data
-
- graphticks % Let Asymptote choose tick spacing
- % Draw the axis on the bottom of the graph frame:
- drawaxis bottom inside outside line inside parallel
-
- % Draw a frame with thin tick marks and a thick border labels and tickmarks
- % outside the frame
- pensize 2 % Start out with thick lines
- % Draw a fat line along left side:
- drawaxis left outside outside drawline noticks nolabels
- pensize .25 % then change to thin lines and
- % Draw thin tick marks inside:
- drawaxis left outside outside noline inside drawlabels
-
- % Plot two sets of y data using different axes on the left and right sides of the graph:
- readcol x 1 % read x
- readcol y 2 % read the first set of y data
- graphlimits % auto limits
- % Draw all but the right axis using the defaults for drawframe:
- drawaxis bottom inside outside line inside perpendicular
- drawaxis top inside outside line inside nolabels
- drawaxis left inside outside line inside perpendicular
- pendash % solid line
- plotline % plot the first set of y data
- readcol y 3 % read the second set of y data
- graphlimits % find the max and min for these data
- % Draw the specially formatted right axis:
- drawaxis right inside outside line inside perpendicular
- pendash dot % set up for a dotted lines
- plotline % plot the second set of y data as a dotted line
-
- drawaxis ? % choose how to draw an axis graphically
-
- $$drawframe
- [ ticks [ labels [ draw [ bottom [ left [ right [ top ]]]]]]]
- Draw a frame around the graph with or without tick marks and tick mark labels
-
- ARGUMENTS:
- ticks ± selects whether ticks should be drawn inside or outside the frame
- inside (=1)
- outside (=2)
- labels ± selects whether tick mark labels should be drawn inside or outside the frame
- inside (=1)
- outside (=2)
- draw ± turns tick mark drawing on and off
- noticks (=0)
- ticks (=1)
- bottom ± selects whether to draw tick labels parallel or perpendicular to the frame
- left nolabels (=0)
- top parallel (=1)
- right perpendicular (=2)
-
- DESCRIPTION:
- Use $b$drawframe$b$ to quickly draw a frame around your graph and label the $i$x$i$ and $i$y$i$
- axes with tick marks. If you need greater control over how the axes should look,
- or if you want to draw only one axis at a time, use the $b$drawaxis$b$ command instead.
-
- Before you use $b$drawframe$b$, make sure you set the variables of the graphics
- environment.
-
- TO: USE:
- Set starting or ending values of the axis $b$graphlimits$b$
- Set the major and minor tick mark spacing $b$graphticks$b$
- Set the position of the graph frame $b$graphframe$b$
- Set the line size or color of the axis $b$pensize$b$,
- $b$pencolor$b$, etc.
- Set the size of tick marks and tick labels $b$scale$b$
- Set the default size for tick marks $b$ticksize$b$
- Set the default size for tick labels $b$fontsize$b$
- Set the notation for tick labels $b$notation$b$
- Set the font for tick labels $b$fontname$b$
-
- To draw complicated frames, you can issue use $b$drawframe$b$ more than once. For
- example, to draw a graph with a thick frame, thin tick marks and tick mark labels in the
- Helvetica font on all but the top of the frame you could use the following commands:
- graphlim 1 23 -1 10 % x runs from 1 to 23, y from -1 to 10
- pensize 3 % thick lines for the frame
- drawframe inside outside noticks nolabels nolabels nolabels nolabels
- pensize .25 % set up to draw thin tick lines
- fontname Helvetica
- drawframe inside outside ticks parallel perpendicular nolabels perpendicular
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$drawaxis$b$
- $b$graphticks$b$
- $b$graphframe$b$
- $b$graphlimits$b$
- $b$notation$b$ $b$scale$b$ $b$fontname$b$
- $b$fontsize$b$ $b$ticksize$b$
- $b$pensize$b$ $b$pendash$b$ $b$pencolor$b$
-
- EXAMPLES:
- drawframe ? % Choose settings interactively
-
- drawframe % Draw a basic frame automatically
-
- % This is the same as the above:
- drawframe inside outside parallel perpendicular nolabels nolabels
-
- % Draw ticks and tick mark labels outside the frame with labels
- % going all the way around the frame:
- drawframe outside outside parallel parallel parallel parallel
-
- $$drawgrid
- [ drawminor ]
- Draw a grid of lines at the major and optionally the minor tick marks
-
- ARGUMENTS:
- drawminor ± controls which grid lines to draw
- false => draw lines only at the major tick marks
- true => draw lines at the minor tick marks as well
-
- DESCRIPTION:
- Use $b$drawgrid$b$ with no arguments to draw a dotted line grid at each major tick mark.
-
- To draw grid lines at the minor tick marks, supply the single argument, drawminor, to
- $b$drawgrid$b$. Use drawminor =˚false to draw lines at only the major tick marks, and
- drawminor = true to draw lines at both the major and minor tick marks. When you
- supply the argument to $b$drawgrid$b$ you also have greater control over how to draw the
- grid lines. For example, you can change the dash pattern for the grid lines with
- $b$pendash$b$ and use $b$drawgrid$b$ to draw the grid lines.
-
- SEE ALSO
- $i$graphics environment$i$
- $b$graphticks$b$
- $b$pendash$b$
-
- EXAMPLES:
- pendash dot
- drawgrid true % draw dotted grid lines on major and minor ticks
- pendash solid
- drawgrid false % draw solid lines at the major tick marks
-
- pendash ?Choose a dash pattern for the grid:
- drawgrid true
- $$drawlabel
- position text
- Draw a label on the graph
-
- ARGUMENTS:
- position ± specifies the label position relative to the pen:
- aboveleft (=7) above (=8) aboveright (=9)
- centerleft (=4) center (=5) centerright (=6)
- belowleft (=1) below (=2) belowright (=3)
- ¥ Note: This arrangement is the same as the keys
- on key boards equipped with key pads.
- text ± the text of the label
-
- DESCRIPTION:
- Use $b$drawlabel$b$ to add labels to your graphs. The first argument to $b$drawlabel$b$
- specifies how Asymptote should position the label relative to the current pen position.
- For convenience you can also use Asymptoteàs built-in constants to specify the position
- or specify the number (1 through 9) directly.
-
- Remember, you can use $b$fontname$b$, $b$pencolor$b$, $b$scale$b$ and $b$rotation$b$ to alter the
- appearance of a label and you can use $b$fontsize$b$ to change the default size for labels.
-
- You can also include special $i$control characters$i$ in the text of your label to:
- ± change font within a label
- ± turn italics on or off
- ± draw super and subscripted characters
- ± insert the value of a user variable
- ± insert the current date or time
- ± insert the name of the current data file or the name of the $i$Recorder Window$i$
-
- The easiest way to see how these control characters work is to select Plot>Draw Label, or
- type:
- drawlabel ?
- in the $i$Command Window$i$. Asymptote displays a dialog box in which you can construct
- your label interactively. As you type, Asymptote shows you what the label looks like.
- You can make selections in the dialog box to insert control characters that change the
- appearance of the text.
-
- The control characters in a label must be preceded by either one or two backslash, \,
- characters. Use a single \ to format only the next character in the label. Use ¼\\½ to
- change the format for all subsequent characters.
-
- CONTROL CHARACTERS:
- \\x - set mode x for all subsequent characters
- \x - set mode x for the next char only
-
- \t - Change the font to Times
- \h - Change the font to Helvetica
- \s - Change to the Symbol font
- \c - Change to the Courier font
- \u - shift up for superscript
- \d - shift down for subscript
-
- \f - insert the name of the current data file
- \r - insert the name of the $i$Recorder Window$i$
- \@ - insert the current time
- \# - insert the current date
-
- To insert the name of a variable or a constant in a label, type a backslash (\) followed by
- the name of the variable and a single space. Asymptote needs the space following the
- variable name so it can determine where the variable name ends and the rest of the label
- begins. Asymptote removes the backslash, the space and replaces the name of the
- variable with the value of the variable converted to text. You can specify the format
- for the conversion with $b$notation$b$ and $b$digits$b$.
-
- Remember that to draw a label outside the graph frame, you need to set $b$cliptoframe$b$
- to false before you use $b$drawlabel$b$.
-
- SEE ALSO:
- $i$graphics environment$i$
- $i$User Variables$i$
- $i$Asymptote Variables$i$
- $b$fontname$b$ $b$scale$b$ $b$rotation$b$
- $b$pencolor$b$ $b$textmode$b$
- $b$moveto$b$ $b$drawto$b$
- $b$notation$b$ $b$digits$b$
- $b$cliptoframe$b$
- $b$fontsize$b$
-
- EXAMPLES:
- moveto 10 12 % position the pen at (10,12)
- drawlabel center Frequency (Hz) % draws the label "Frequency (Hz)"
- % centered on the current pen position.
-
- moveto ?Click where would you like to place the label:
- drawlabel ? % Get the text of the label interactively
- % using the Draw Label dialog box
-
- % Draw the label y = e(x2 + y2) + sin(t) to the right of the pen:
- drawlabel centerright y = e\\u(x\u2 + y\u2)\\d + sin(\st)
-
- % Put a label with the date and the name of the current data file in the upper
- % left hand corner of the graph:
- moveto \xright \xleft - .1 * \xleft + \ytop \ybottom - .9 * \ybottom +
- drawlabel 6 Data from: \f Date: \#
-
- % Set a user variable and use it in a label
- set runnumber 3
- % draw the label ¼Run #3 data½ to the right of the pen
- drawlabel centerright Run #\runnumber data
- $$drawpoint
-
- Draw a point at the pen position
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$drawpoint$b$ to draw a point on your graph. Asymptote draws the point at the
- current pen position. You can specify the symbol to draw with $b$pointsymbol$b$. You
- will probably find $b$drawpoint$b$ most useful when you are adding legends to your
- graph or when you want to draw a single point on your graph.
-
- The size and rotation of the point are controlled by the $b$scale$b$ and $b$rotation$b$
- commands. Set the default label size with the $b$fontsize$b$
- command. The current pen characteristics and fill pattern are also used to draw the
- point (see $i$graphics environment$i$).
-
- Remember that to draw a point outside the graph frame, you need to set $b$cliptoframe$b$
- to false before you use $b$drawpoint$b$.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$pencolor$b$ $b$pensize$b$ $b$penpattern$b$ $b$penmode$b$
- $b$fillpattern$b$ $b$scale$b$ $b$rotation$b$
- $b$moveto$b$ $b$drawto$b$
- $b$cliptoframe$b$
- $b$fontsize$b$
-
- EXAMPLES:
- moveto x .1 + y % shift the position of the pen by .1 units in x
- pointsymbol 4 filled % choose to draw a filled square
- drawpoint % draw a filled square at the shifted position
-
- moveto ? % Position the pen interactively
- pointsymbol ?What point symbol? % Choose a point symbol graphically
- drawpoint
- $$drawtitle
- text
- Add a title to the graph centered above the graph frame
-
- ARGUMENTS:
- text ± the text of the title
-
- DESCRIPTION:
- Use $b$drawtitle$b$ to draw a title on your graph. Asymptote centers the title above the
- graph frame. You can change the position of the frame on the page with
- $b$graphframe$b$. To put the title somewhere else on the page, use $b$moveto$b$ and
- $b$drawlabel$b$ instead.
-
- As with any label, you can change any of the variables of the
- $i$graphics˚environment$i$.such as $b$fontname$b$, $b$pencolor$b$, and
- $b$scale$b$to change the appearance of the title and you can change the default label size
- with $b$fontsize$b$. The title text can also include control characters to format individual
- characters or words or to insert the date, the name of the data file or the value of a
- variable. See the description of the $b$drawlabel$b$ command for an explanation how to
- use control characters in labels.
-
- Remember, you can interactively edit and view how your title looks by typing the
- command
- drawtitle ?
- in the $i$Command Window$i$, or by selecting Draw>Title.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$drawlabel$b$
- $b$fontname$b$ $b$scale$b$ $b$pencolor$b$ $b$textmode$b$
- $b$fontsize$b$
- $b$moveto$b$ $b$drawto$b$
-
- EXAMPLES:
- drawtitle The effect of gamma rays on man-in-the-moon marigolds
-
- fontname Helvetica
- scale 2.0
- drawtitle H\sa Line Intensities from data file:\f
- $$drawto
- x y
- Draw a line from the current pen position to ($i$x$i$, $i$y$i$)
-
- ARGUMENTS:
- x, y ± $i$x$i$ and $i$y$i$ coordinates of the end of the line
-
- DESCRIPTION:
- Use $b$drawto$b$ to draw a line from the current pen location to the coordinates you
- specify. Asymptote uses the current pen properties to draw the line. Use any of the
- commands like $b$pensize$b$ and $b$pendash$b$ to change the appearance of the line
- (see $i$graphics environment$i$).
-
- A convenient way to draw a line on your graph is to use ? following the $b$drawto$b$
- command. Type
- drawto ?
- in the $i$Command Window$i$ or in a script. Asymptote activates the graph cursor which you
- can use to position the end of the line with the mouse. You can also select Draw>Move˚To
- to activate the graph cursor.
-
- Remember that to draw a line outside the graph frame, you need to set $b$cliptoframe$b$
- to false before you use $b$drawto$b$.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$moveto$b$ $b$drawarrowto$b$ $b$cursor$b$
- $b$pensize$b$ $b$pendash$b$ $b$penpattern$b$ $b$pencolor$b$
- $b$scale$b$
- $b$cliptoframe$b$
-
- EXAMPLES:
- drawto 3.4 56.9 % draw a line from the current pen position to (3.4 56.9)
- drawto ? % set the end point of the line with the graph cursor
-
- pencolor red
- pendash short
- drawto 4 y 10 + % draw a red, dashed line from (x,y) to (4,y+10)
-
- pensize 4 % get ready to draw a fat line
- moveto 1 1 % move to (1,1)
- drawto x(10) y(10) % draw a line from (1,1) to the position
- % of the 10th data point
- $$drawxlabel
- text
- Add a label to the x axis of the graph
-
- ARGUMENTS:
- text ± the text of the label
-
- DESCRIPTION:
- Use $b$drawxlabel$b$ to label the $i$x$i$ axis of your graph. Asymptote draws $i$x$i$ labels centered
- below the graph frame. You can change the position of the frame on the page with
- the $b$graphframe$b$ command. If you want to put the $i$x$i$ label elsewhere on the page,
- use $b$moveto$b$ and $b$drawlabel$b$ instead.
-
- As with any label, you can change the appearance of the text by adjusting the variables of
- the $i$graphics environment$i$. You can include control characters in the label to format
- the text or to insert the value of a variable or constant. See the description of the
- $b$drawlabel$b$ command for an explanation.
-
- If you want to choose text of the label interactively, put the command
- drawxlabel ?
- into your script or select Draw>X˚Label.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$drawlabel$b$ $b$drawylabel$b$ $b$drawtitle$b$
- $b$fontname$b$ $b$scale$b$ $b$pencolor$b$ $b$textmode$b$
- $b$fontsize$b$
- $b$scale$b$
- $b$moveto$b$ $b$drawto$b$
-
- EXAMPLES:
- drawxlabel Frequency (Hz)
-
- pencolor gray
- drawxlabel Sin(\\st + o\\t)
- $$drawylabel
- text
- Add a label to the y axis of the graph
-
- ARGUMENTS:
- text ± the text of the label
-
- DESCRIPTION:
- Use $b$drawylabel$b$ to label the $i$y$i$ axis of your graph. Asymptote draws $i$y$i$ labels centered
- below the graph frame. You can change the position of the frame on the page with the
- $b$graphframe$b$ command. If you want to put the $i$y$i$ label elsewhere on the page,
- use $b$moveto$b$ and $b$drawlabel$b$ instead.
-
- As with any label, you can change the appearance of the text by adjusting the variables of
- the $i$graphics environment$i$. You can include control characters in the label to format
- the text or to insert the value of a variable or constant. See the description of the
- $b$drawlabel$b$ command for an explanation.
-
- If you want to choose text of the label interactively, put the command
- drawylabel ?
- into your script or select Draw>Y˚Label.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$drawlabel$b$ $b$drawxlabel$b$ $b$drawtitle$b$
- $b$fontname$b$ $b$scale$b$ $b$pencolor$b$ $b$textmode$b$
- $b$fontsize$b$ $b$scale$b$
- $b$moveto$b$ $b$drawto$b$
-
- EXAMPLES:
- drawylabel Temperature (K)
-
- pencolor gray
- drawylabel Sin(\\st + o\\t)
- $$export
- [x][y][e][p][l]
- Write the values of Asymptoteàs vectors in the Data Window
-
- ARGUMENTS:
- x,y,e,p,l ± the names of the vectors to export (can be in any order)
-
- DESCRIPTION:
- You can use the export command to write out the values of Asymptote's vectors in the
- $i$Data Window$i$. First, use the datafile command to open a data file. Next, issue the
- $b$export$b$ command. You can follow the $b$export$b$ command with the name or names of the
- vectors you want to export. For example, to export the $i$x$i$ $i$y$i$ and $i$e$i$ vectors to the
- $i$Data Window$i$, use
- export x y e
- You can export vectors in any order. If you don't specify which vectors you want to
- export, Asymptote exports the $i$x$i$ and $i$y$i$ vectors.
-
- Asymptote uses the current value of the Asymptote variable $i$digits$i$ (set with the $b$digits$b$
- command) to determine how many digits will follow the decimal point in floating point
- numbers. Large or very small numbers appear in exponential notation.
-
- You might also use export to save the results of some lengthy calculation in Asymptote.
- Remember, you can use the registers of the rpn calculator to store whole vectors. The
- $b$export$b$ command might also be useful when you use $b$readcursor$b$ to read data from
- your graph and export the data to another application.
-
- SEE ALSO:
- $b$datafile$b$
- $b$digits$b$
- $b$readcursor$b$
-
- EXAMPLES:
- digits 3 % Use 3 digits following the decimal point
- export % Export the x and y vectors only
-
- export y e p % Export y e and p in that order
-
- export x y e p l % Export everything
- $$fillpattern
- pattern
- Set the fill pattern for points and polygons
-
- ARGUMENTS:
- pattern ± the number of the new pattern:
- 0 through 38
- or the pattern name
- none, black, darkgray, gray, lightgray,
- squares, vertical, horizontal, diagonal,
- white, bricks
-
- DESCRIPTION:
- Use $b$fillpattern$b$ to set the fill pattern for drawing points and polygons. Valid pattern
- numbers are 0 through 38 or the names: none, black, darkgray, gray, lightgray,
- squares, vertical, horizontal, diagonal, white, bricks. These pattern numbers are
- Asymptote constants (see $i$Variables and Constants$i$).
-
- Remember, you can select Set>Fill˚Pattern or type
- fillpattern ?
- in the $i$Command Window$i$ to choose the fill pattern from a picture of the various fill
- patterns.
-
- SEE ALSO:
- $i$Variables and Constants$i$
- $b$penpattern$b$
- $b$pencolor$b$
- $b$plotpoints$b$ $b$plotpolygon$b$ $b$plothistogram$b$
-
- EXAMPLES:
- fillpattern gray % draw solid gray filled squares at each point
- pointsymbol 4 filled
- plotpoints
-
- fillpattern penpattern % make the fill pattern the same as the pen pattern
-
- rpn ran >x ran >y
- graphlimits
- fillpattern ?Pick a fill pattern for this polygon:
- plotpoly
- $$fitxy
- [[ N ] expression ]
- Fit y = f(x) with a polynomial or a function you specify
-
- N ± the order of the polynomial to fit (default = 1)
- 1 = linear, 2 = quadratic, 3 = cubic, etc,..
- OR
- N ± the number of parameters in the function to fit
- expression ± an expression for the function to fit
-
- DESCRIPTION:
- Use $b$fitxy$b$ to fit a function to the ($i$x$i$, $i$y$i$) data points using least squares. The function
- can either be a polynomial or a general expression that you specify.
-
- ____________________ TO FIT A POLYNOMIAL ___________________________________
- To fit a polynomial
- y = a0 + a1 x + a2 x^2 + ... + aN x^N
- to your ($i$x$i$, $i$y$i$) data, follow the $b$fitxy$b$ command with a single argument, N (the order of
- the polynomial to fit). For example, the command
- fitxy 3
- fits the function
- y = a0 + a1 x + a2 x^2 + a3 x^3.
- You can use the values in the e vector to give a different weight to each of the ($i$x$i$, $i$y$i$)
- points in the polynomial fit. See Using Errors below.
-
- After the fit, Asymptote updates the values of the $i$a0$i$, $i$a1$i$, $i$a2$i$, ... , $i$aN$i$ user variables with
- the polynomial coefficients. It also stores the error for each coefficient (the diagonal
- elements of the covariance matrix) in the user variables $i$a0sig$i$, $i$a1sig$i$, ... , $i$aNsig$i$.
- Asymptote stores the chi square of the fit in the user variable chisq. You can use rpn
- and plotline to calculate the fit and plot it on top of your data. For example, to fit
- a 2nd order polynomial and plot the final fit use the following commands:
- fitxy 2
- rpn <x 2 y^x a2 * <x a1 * + a0 + >y
- plotline
- When you select Data>Fit˚Y˚=˚F(x), Asymptote displays a dialog box which makes it easy
- to fit your data and plot the final fit.
-
- ____________________ TO FIT A FUNCTION ___________________________________
- To fit an arbitrary function to your data, follow the $b$fitxy$b$ command with two arguments.
- The first argument is the number of parameters in the function you want to fit. The
- second argument is an rpn expression for the function. The expression should evaluate
- to a single argument. For example, to fit a sine wave with phase $i$a0$i$ and amplitude $i$a1$i$,
- you could use
- fitxy 2 x a0 - sin a1 *
- The expression "x a0 - sin a1 *" subtracts $i$a0$i$ from each x data point, calculates the
- sine and multiplies the result by $i$a1$i$.
-
- The easiest way to write $b$fitxy$b$ expressions is to select Data Fit Y = F(x) and use the
- fitxy dialog box to specify what you want to fit. Asymptote's curve fit dialog helps
- guide you through the process of fitting your data.
-
- INITIAL VALUES FOR PARAMETERS:
- Asymptote uses the Levenburg-Marquardt method to estimate the values of up to 32 free
- parameters by minimizing chi square. Asymptote must begin this process starting with
- your best guesses for the values of the model parameters. If you don't supply good
- initial values for the parameters, $b$fitxy$b$ will probably produce poor results. You can
- create and set the initial values of the fitting variables $i$a0$i$, $i$a1$i$, ... , $i$aN$i$ using the set
- command. If a variable doesn't exist when $b$fitxy$b$ starts, Asymptote creates a new user
- variable and sets its initial value to 1.0.
-
- HOLDING PARAMETERS FIXED:
- Asymptote looks for the user variables $i$a0fixed$i$, $i$a1fixed$i$, ... , $i$aNfixed$i$ to determine if
- you want to hold any of the fitting parameters fixed. If you set one of these variables
- to 'true' (a non-zero value), Asymptote holds that parameter fixed during the fit.
-
- USING ERRORS (WEIGHTING EACH DATA POINT):
- Both polynomial fitting and general expression fitting use the values in the $i$e$i$ vector to
- constrain the fit. If you know the standard deviation of each point, store these values
- in the $i$e$i$ vector before fitting. With the $i$e$i$ vector you can weight each of the points
- differently in the fit. A smaller value in the $i$e$i$ vector means a greater weight is given
- to that point and a greater impact on the fit. To remove a point from the fit entirely,
- set its $i$e$i$ vector to a value much larger then the other values in the $i$e$i$ vector. If the
- $i$e$i$ vector contains zero or negative values, Asymptote asks you if you want to give all
- the points equal weight.
-
- If you don't know the errors of your data points, use
- rpn 1 >e
- to fill the $i$e$i$ vector with a constant value of 1.0 for each point. When the $i$e$i$ vector
- is 1.0 for all points, Asymptote automatically multiplies the fit errors $i$a0sig$i$, $i$a1sig$i$, ...,
- $i$aNsig$i$, by sqrt[chisq/(npts - nParameters)]. Essentially this assumes that the fit is a
- good fit. Remember that if you don't know the errors in your data points, the value of chisq
- is meaningless.
-
- PLOTTING EACH ITERATION:
- To help you view the progress of the fit, set the user variable $i$plot_each_fit$i$ to true
- before you execute $b$fitxy$b$. With $i$plot_each_fit$i$ set to true, Asymptote plots the fitted
- function on your graph with each iteration. When $b$fitxy$b$ finishes, Asymptote restores
- the graph to the way it looked before $b$fitxy$b$ started. Plotting each iteration is a good
- way to monitor the progress of the fit and to judge how good your initial guesses were.
- If the user variable $i$plot_each_fit$i$ doesn't exist before $b$fitxy$b$ starts, Asymptote creates
- the variable and sets it to true.
-
- FIT RESULTS:
- After $b$fitxy$b$ executes, Asymptote sets the user variable chisq to the final chi square of
- the fit. It sets the user variables $i$a0$i$, $i$a1$i$, $i$a2$i$, ..., $i$aN$i$ to the estimated parameter values.
- Asymptote stores an estimate of the error of each parameter (diagonal elements of the
- covariance matrix) in the user variables $i$a0sig$i$, $i$a1sig$i$, ... , $i$aNsig$i$. It also sets the
- variable converged to true or false depending on whether $b$fitxy$b$ converged to a best fit
- and sets the variable iterations to the number of iterations that were completed.
-
- IF YOUR FIT PRODUCES UNDESIRABLE RESULTS:
- If you aren't able to obtain a satisfactory fit, try the following:
- 1. Check to see that the function is a good model of your data.
- Set $i$plot_each_fit$i$ to true before fitting to see if the function you are
- trying to fit adequately represents your data.
- 2. Try changing the initial values of the fit parameters.
- Don't use 0.0 for initial guesses. Use 0.1 or 0.0001 instead.
- Plot your initial guesses to see if they are reasonable or set $i$plot_each_fit$i$
- to true before fitting.
- 3. Make sure all the coefficients of your function are distinguishable.
- You should not be able to algebraically combine two parameters into one.
- For example, if a function contains two constants or two identical terms,
- you can combine them as one.
- 4. Make sure that the best value for any parameter in your model is not infinity.
-
- FITTING ERRORS:
- (1) SINGULAR MATRIX:
- The most common error message when fitting an arbitrary function to your data is
- "Singular Matrix." Usually this happens when the function you are fitting does not have
- a unique solution. If Asymptote reports a singular matrix error, first try the steps
- above; then check to make sure that changing each parameter of the function has some
- effect on the fitting function.
-
- (2) OVERFLOW, UNDERFLOW or DIVIDE BY ZERO:
- Asymptote may encounter a numerical error such as an overflow, underflow or a
- division by zero when it evaluates the fitting function and its partial derivatives.
- Because Asymptote uses extended double precision for all of its computations, this
- usually does not happen unless the fitting process has arrived at extreme values.
- It can happen however, if the function has singularities in the range of x values.
- After trying the steps above, try shifting or scaling the values in the x vectors
- to values near zero.
-
- SEE ALSO:
- $b$rpn$b$
- $b$plotline$b$
-
- EXAMPLES:
- % Polynomial fitting:
-
- readcol x 1 % read x data
- readcol y 2 % read y data
- pointsymbol 4 cross
- plotpoints % plot the input data
- readcol e 3 % read the errors of the points
- ploterrors top % plot vertical error bars in both directions
- ploterrors bottom
- fitxy 2 % calculate a quadratic fit
- rpn <x 2 y^x a2 * <x a1 * + <a0 + >y % calculate y = a0 + a1 x + a2*x^2
- plotline % plot the result as a line
- title Fit Results: a0 = \a0, a1 = \a1, a2 = \a2
-
- % Fitting a Gaussian:
- datafile mydata
- readcolumn x 1
- readcolumn y 2
- readcolumn e 3
- graphlimits
- plotpoints
-
- % Estimate initial values:
- set a0 5 % constant
- set a0fixed no
- set a1 0.01 % slope
- set a1fixed no
- set a2 10 % gaussian 1 center
- set a2fixed yes % Fix the value of the center
- set a3 4 % gaussian 1 width
- set a3fixed no
- set a4 100 % gaussian 1 amp
- set a4fixed no
- set plot_each_fit yes % Plot each iteration of the fit
- % Fit the data:
- fitxy 5 a0 x a1 * + x a2 - a3 / 2 y^x -1 * e^x a4 * +
- % Calculate the fit:
- rpn a0 <x a1 * + <x a2 - a3 / 2 y^x -1 * e^x a4 * + >y
- % And plot the fit:
- plotline
-
- $$fontname
- fontname
- Set the font for graph labels
-
- ARGUMENTS:
- fontname ± the name of the new graph font
-
- DESCRIPTION:
- Use $b$fontname$b$ to select the font for drawing graph labels. Select Set>Font to view a
- list of the fonts installed in your system.
-
- Asymptote uses the current value of the scale factor (set with the $b$scale$b$ command)
- when drawing the labels. A scale factor of 1 produces characters at the default size set
- with $b$fontsize$b$. Asymptote also rotates all labels (except for the title, and the
- $i$x$i$ and $i$y$i$ axis labels) by the amount you specify with the $b$rotation$b$ command.
- A rotation of 0 degrees produces labels parallel to the $i$x$i$ axis. You can rotate
- labels through any angle, but only labels rotated by 0, 90, 180, or 270 degrees will
- print on all printers. Asymptote draw labels rotated by angles other than 0, 90, 180
- or 270 degrees as gray rectangles. This is called ¾greeking.à Greeked labels only
- print correctly on PostScript printers.
-
- SEE ALSO:
- $b$fontsize$b$ $b$scale$b$ $b$rotation$b$
- $b$drawframe$b$ $b$drawlabel$b$ $b$drawxlabel$b$ $b$drawylabel$b$ $b$drawtitle$b$ $b$plotlabels$b$
- $b$pencolor$b$
- $b$textmode$b$
-
- EXAMPLES:
- fontname Helvetica % set the font for labels and text to helvetica
- fontsize 12 % make 12 pt the default
- scale 2.0 % draw letters at 24 pt
- drawlabel center This is a test label in Helvetica 24 pt
-
- fontname Times
- rotation 45
- drawlabel left I'm a Times labels rotated by 45¡
- $$fontsize
- points
- Set the point symbol to use when drawing points
-
- ARGUMENTS:
- points ± text size when scale = 1.0 (in points)
-
- Use $b$fontsize$b$ to set the size (in points) that you want Asymptote to use for labels
- when the scale factor is set to 1.0. The $b$fontsize$b$ command is a handy way to adjust
- the size of your labels without having to change $b$scale$b$ every time you draw text.
-
- The default text size is 12 points. Put the $b$fontsize$b$ command in your Start Up
- script if you want to change this default.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$drawframe$b$ $b$drawlabel$b$ $b$drawxlabel$b$ $b$drawylabel$b$ $b$drawtitle$b$ $b$plotlabels$b$
-
- EXAMPLES:
- pointsize 6 % set the point size to 6 points
- scale 1
- plotpoints % draw points that are 6 points in diameter
- scale 2
- plotpoints % draw 12 pt points
-
- $$for
- variable from start to stop [ by step ] do command
- Repeat a command while incrementing or decrementing a variable
-
- ARGUMENTS:
- variable ± the user variable to increment or decrement
- start ± an expression for the starting value
- end ± an expression for the ending value
- step ± an expression for the amount to increment or decrement with each step
- command ± the command to execute each time through the loop
-
- DESCRIPTION:
- Use $b$for$b$ to repeat a command over and over again while Asymptote increments or
- decrements a user variable. You can use the value of the user variable in a script to read
- data from a sequence of numbered data files or to run a sequence of numbered scripts.
-
- Following the $b$for$b$ command, you must specify the name of the user variable you
- want to loop. If there is no user variable with the name you specify, Asymptote
- automatically creates one for you. Next, type the word ¾fromà followed by an expression
- for the starting value of the variable. After the starting value expression, type ¾toà
- followed by an expression for the ending value of the variable. These expressions could
- simply be constants (for example, for i from 1 to 10). You can also use more complicated
- expressions involving other variables or constants (for example, for i from j 2 + to k 1 -).
-
- Following the ending expression, you can (optionally) specify a step expression that
- Asymptote uses to increment or decrement the user variable. To specify a step expression,
- follow the stop expression by the word ¾byà followed by the step expression. For
- example, for i from 100 to 0 by˚-1 steps the variable i down from 100 to 0 in steps of
- -1. If you don't specify a step expression, Asymptote uses the expression 1 to increment
- the variable by 1 each time through the loop.
-
- Finally, type ¾doà followed by the command you want to execute each time through the
- loop. You can pass arguments to the command on the rest of the line.
-
- SEE ALSO:
- $b$if$b$
- $b$while$b$
- $b$repeat$b$
-
- EXAMPLES:
- % A simple loop:
- for i from 1 to 10 do myScript
-
- % Step myVal from 10 to 0 by 1 and execute nextGraph:
- for myVal from 10 to 0 by -1 do nextGraph
-
- % Step i from 1 to 64 by powers of 2
- for i from 1 to 64 by i 2 * do nextpower i
-
- % Stop looping when i > j
- for i from 0 to j do myLoop
- $$fullscreen
- [ on/off ]
- Expand the $i$Graph Window$i$ to fill the full screen
-
- ARGUMENTS:
- on/off ± if true, expand the $i$Graph Window$i$ to fill the screen and hide the menus
- else, shrink the $i$Graph Window$i$ back to its original size and show the menus
-
- DESCRIPTION:
- Use $b$fullscreen$b$ to turn Asymptoteàs full screen mode on or off. Full screen mode is
- useful if you are taking pictures of the screen or making a presentation.
-
- When you turn full screen mode on, Asymptote hides the menu bar and expands the graph
- to fill the entire screen. When you turn full screen mode off, Asymptote shrinks the
- $i$Graph Window$i$ back to its original size and makes the menu bar visible again. To toggle
- between these two modes, issue the $b$fullscreen$b$ command without an argument.
- If you specify the full screen mode you want, you may find it convenient to use the
- Asymptote constants ¾onà and ¾offà.
-
- All of Asymptoteàs features function normally in full screen mode. If you type something
- with the keyboard, Asymptote makes the $i$Command Window$i$ visible. You can then type
- the rest of the command and execute it. Even though the menu bar is not visible in full
- screen mode, you can still issue menu commands. Simply type the command key
- equivalent of a command or type command-.(period). Asymptote makes the menu bar
- visible and executes the command. To hide the menu bar again, type
- fullscreen on
- in the $i$Command Window$i$.
-
- While you are in full screen mode you can scroll and zoom the graph with the mouse.
- This is a handy way to position the graph exactly as you want it positioned. Hold down
- the option key and click and drag on the graph to scroll it. Hold down the command key
- and click to zoom in. Hold down the command and option keys together and click to zoom
- out. To zoom the graph to display the graph frame or the entire page, use $b$showgraph$b$ or
- $b$showpage$b$. To zoom the graph to a particular zoom factor, you can type $b$zoomgraph$b$
- in the $i$Command Window$i$.
-
- The background in the $i$Graph Window$i$ is normally white. If you are taking pictures of the
- screen or making a presentation, you may want to use $b$backcolor$b$ to change the
- background color of the $i$Graph Window$i$.
-
- SEE ALSO:
- $b$showgraph$b$
- $b$showpage$b$
- $b$zoomgraph$b$
- $b$backcolor$b$
-
- EXAMPLES:
- backcolor 80 80 80 % set the background color to a light gray
- fullscreen on % expand the $i$Graph Window$i$ to full screen
-
- fullscreen % toggle between full screen mode on or off
-
- fullscreen off % turn full screen mode off and display the menu bar
- $$graphaspect
- ratio
- Set the aspect ratio of the graph
-
- ARGUMENTS:
- ratio ± the aspect ratio, y scale = ratio * $i$x$i$ scale
-
- DESCRIPTION:
- Use $b$graphaspect$b$ to fix the aspect ratio of the $i$x$i$ and $i$y$i$ axes.
-
- The $b$graphaspect$b$ command is particularly useful when you are making log-log
- graphs and want the number of decades per inch on the $i$x$i$ and $i$y$i$ axes to agree.
- When the scale of the $i$x$i$ and $i$y$i$ axes is the same, the aspect ratio is 1 and the
- slope, a, of a line on your graph (y = a*x) is also the exponent in the power-law that
- relates $i$x$i$ and $i$y$i$ (y = xa). The $b$graphaspect$b$ command is also useful when you
- are creating linear graphs and want them to have a square grid. When you use
- $b$graphaspect$b$ to set the aspect radio of your graph to 1, the $i$x$i$ and $i$y$i$ axes
- have the same number of tick marks per inch and $b$drawgrid$b$ produces a square
- coordinate grid.
-
- Note that $b$graphaspect$b$ works by adjusting the size of the graph frame, not the limits
- of your graph. Before you use $b$graphaspect$b$, you must set the limits of your graph
- with $b$graphlimits$b$ and position the graph frame on the page with $b$graphframe$b$.
- When you issue the $b$graphaspect$b$ command, Asymptote adjusts the width or the
- height of the graph frame so that the aspect radio is the ratio you specified. Asymptote
- also tries to make the new frame fit inside the old. Now you are ready to draw the axes
- of the graph with $b$drawframe$b$ or $b$drawaxis$b$ and plot your data.
-
- SEE ALSO:
- $b$graphlimits$b$
- $b$graphframe$b$
- $b$graphunits$b$
- $b$graphticks$b$
- $b$drawframe$b$ $b$drawaxis$b$
-
- EXAMPLES:
- graphlimits 5 25 -10 10 % set the graph limits
- graphaspect 1.0 % make the y axis scale the same as x
- drawframe
-
- graphticks -1 0 -1 0 % use log-log tick marks
- graphlimits 0 5 1 4 % 1 to 105 in x; 10 to 104 in y
- graphaspect 1.0 % plot the same number of decades per inch
- drawframe % on the x and y axes
-
- graphlimits 0 100 0 100
- graphaspect 2.0 % make y have twice the scale as x
- $$graphframe
- gleft gright gbottom gtop
- Set the position of the graph frame on the page
-
- ARGUMENTS:
- gleft ± left side of the frame in page coordinates
- gright ± right side of the frame in page coordinates
- gbottom ± bottom of the frame in page coordinates
- gtop ± top of the frame in page coordinates
-
- DESCRIPTION:
- Use $b$graphframe$b$ to position the graph frame on the page. The $b$graphframe$b$
- command uses page coordinates with the origin (0,0) in the lower left of the page. You
- can use $b$graphunits$b$ to choose which units you want to use for page coordinates (inches,
- cm, or points).
-
- Keep in mind that the dimensions of the page are stored in the Asymptote variables \pleft,
- \pright, \pbottom and \ptop. You can use these to specify the position of the graph on the
- page. For example, to set the graph frame to fill the page with a 1 inch margin use the
- following commands:
-
- graphunits in
- graphframe pleft 1 + pright 1 - pbottom 1 + ptop 1 -
- drawframe
-
- SEE ALSO:
- $i$Variables$i$
- $b$graphunits$b$
- $b$drawframe$b$
- $b$drawaxis$b$
-
- EXAMPLES:
- graphframe ? % choose the graph frame interactively
-
- graphunits cm
- graphframe 5 5 15 15 % a 10 cm by 10 cm graph
-
- graphunits inches
- graphframe 2 2 ptop 2 - pright 2 - % draw a graph with a 2 inch margin
-
- % Shift the graph frame up by the current height of the graph plus one inch:
- graphunits inches
- set vertoffset gtop gbottom - 1 +
- graphframe vertoffset gbottom + gleft vertoffset gtop + gright
- drawframe inside nolabels nolabels nolabels nolabels
- $$graphlimits
- [ xleft xright ybottom ytop ]
- Set the limits of the graph
-
- ARGUMENTS:
- xleft ± x value at left side of the graph
- xright ± x value at right side of the graph
- ybottom ± y value at bottom of the graph
- ytop ± y value at the top of the of the graph
-
- DESCRIPTION:
- Use $b$graphlimits$b$ to set the $i$x$i$ and $i$y$i$ limits of your graph. Asymptote uses these
- limits for all subsequent plotting and drawing.
-
- To have Asymptote choose the limits of your graph for you, use $b$graphlimits$b$ command
- without arguments. Asymptote chooses limits that make all the points visible.
-
- To set the limits of the graph you must specify all four arguments to the $b$graphlimits$b$
- command. The first and second arguments are the $i$x$i$ values at the left and right sides
- of the graph frame. The third and fourth arguments are the $i$y$i$ values at the bottom
- and top of the frame. If you want the $i$x$i$ or the $i$y$i$ axis to run 'backward' (increasing
- from left to right or increasing from top to bottom) just specify the larger axis
- limit first. See the example below.
-
- If you want to specify the limits for one axis, but have Asymptote choose the limits of the
- other axis for you, specify 0 0 for the limits of the axis you want Asymptote to adjust.
- For example, if you type the command
- graphlimits 3 4 0 0
- Asymptote sets the $i$x$i$ axis to range from 3 to 4 and chooses the $i$y$i$ axis limits
- automatically.
-
- SEE ALSO:
- $b$drawframe$b$
- $b$drawaxis$b$
-
- EXAMPLES:
- graphlimits % set the limits automatically for both x and y
-
- graphlimits 2 5 2.4 9 % set x limits to range from 2 to 5 and y from 2.4 to 9
-
- graphlimits 0 0 1 12 % choose x automatically, set y limits to 1 to 12
-
- graphlimits % choose limits automatically
- graphlimits 0 xright ybottom ytop % then fix xleft to be 0.0
-
- graphlimits 1 -1 0 10 % x runs 'backward' from 1 to -1; y from 0 to 10
-
- graphlimits % first have Asymptote choose limits
- graphlimits xleft xright ytop ybottom % then flip the y axis 'upside down'
- $$graphticks
- [ xminor xmajor yminor ymajor ]
- Set the spacing of major and minor tick marks
-
- ARGUMENTS:
- xminor, yminor ± spacing for minor tickmarks in graph coordinates
- xmajor, ymajor ± spacing for major tickmarks in graph coordinates
-
- DESCRIPTION:
- Use $b$graphticks$b$ to set the intervals for major and minor tick marks. ¾Minorà refers
- to the interval between small tick marks and ¾majorà refers to the interval between
- large tick marks. To have Asymptote choose the tick spacing for you, use $b$graphticks$b$
- with no arguments. Specify 0 for xmajor or ymajor to have Asymptote choose the
- tick spacing of one axis while you specify the tick spacing of the other.
-
- To draw logarithmic minor tick marks and major tick marks at each decade, set xminor
- or yminor to a negative value. For example, use xminor = -1 and xmajor = 0 to draw a
- logarithmic $i$x$i$ axis and let Asymptote choosing the spacing for the major tick spacing
- (about one major tick every inch). To specify the tick spacing directly, set xminor to
- the spacing in decades for minor tick marks and xmajor to the number of decades
- between major tick marks. For example, use xminor = -0.5 and xmajor = -2 to draw
- minor ticks every half decade and major tick marks every 2nd decade.
-
- When you plot log-log graphs, Asymptote plots the values in the $i$x$i$ and $i$y$i$ vectors directly
- and doesnàt take the logarithm of them before plotting the points. When you make
- a log-log or log-linear graph, use $b$rpn$b$ to calculate the replace the values
- in you $i$x$i$ and $i$y$i$ vectors before plotting them.
-
- SEE ALSO:
- $b$graphlimits$b$
- $b$drawframe$b$
- $b$drawaxis$b$
- $b$drawgrid$b$
- $b$rpn$b$
-
- EXAMPLES:
- graphticks .5 1 20 100 % small x ticks every .5 units of x, big ticks every 1 in x
- % small y ticks every 20 units of y, big ticks every 100
-
- readcol x 1
- readcol y 2
- rpn <x log >x % replace the x values with their logs
- rpn <y log >y % do the same for y
- graphlimits 1 3 -1 1 % x decades from 1 to 3, y from decades -1 to 1
- graphticks -1 0 -1 0 % log ticks on both axes
- drawframe
-
- readcol x 1
- readcol y 2
- rpn <y log >y % calculate log of y
- graphlimits 1 3 -1 1 % x runs from 1 to 3
- % y limits from 10^-1 to 10^1
- graphticks 0 0 -1 0 % choose x ticks automatically, y ticks are logarithmic
- drawframe
-
- graphticks ? % choose tick spacing via a dialog box
- $$graphunits
- unitname
- Set the units for measuring page coordinates
-
- ARGUMENTS:
- unitname ± unit name (inches, centimeters, or points)
-
- DESCRIPTION:
- Use $b$graphunits$b$ to specify the units you want to use for page coordinates. Specify
- either 'inches,' 'cm' or 'points' or the abbreviations 'in,' 'cm' or 'pts.' After you change
- the units with $b$graphunits$b$, all subsequent commands that take page coordinates as
- arguments (for example $b$graphframe$b$) assume that arguments you give them are in
- the new units. The Status and Variables Windows also display all quantities in page
- coordinates using the units you have specified with $b$graphunits$b$.
-
- SEE ALSO:
- $i$Constants$b$
- $b$graphframe$b$
-
- EXAMPLES:
- graphunits cm
-
- graphunits inches
- graphframe 2 4 4 8 % 2 to 4 inches in x, 4 to 8 inches in y
- drawframe
- $$help
- [ command ]
- TO USE ASYMPTOTE'S ON-LINE HELP:
- ¥ Type 'help' in the $i$Command Window$i$:
-
- ¥ To get help on a particular command, type
- help commandName
-
- ¥ To get help on a menu command or window:
- Press the command (clover leaf) and ? keys together to activate help cursor.
- Then, select a menu command or click a window with the mouse.
-
- ¥ Select a help topic from the Help menu under the Apple Menu
-
- ¥ Select ¾Helpà from the Window menu Window>Help or type command-H
-
- ¥ Click the Help button when an error message appears.
- <<< Click on the scroll bar for more information <<<<<<<<<<
-
- Use the left and right arrow keys in the lower left corner of this window to move
- between entries in the help file. Each help entry has a title (usually a command
- name) followed by a list of arguments. Optional arguments are enclosed in square
- brackets [].
-
- For a complete description of how to use on-line help file, see the section titled
- ¼Using the Help Window½ in Chapter 3 of the Asymptote Useràs Guide.
- $$hidewindow
- [ windowname ]
- Make a window invisible
-
- ARGUMENTS:
- windowname ± the name of the window to hide
-
- DESCRIPTION:
- Use $b$hidewindow$b$ to make a window invisible and reduce screen clutter. You can
- also hide a window by clicking on its close box while holding down the option key. To
- make a hidden window visible again, use $b$showwindow$b$ or select the window from
- the $i$Windows menu$i$.
-
- Hiding a window does not release the memory is occupies. To close a window and release
- the memory it occupies, use $b$closewindow$b$ rather than $b$hidewindow$b$.
-
- If you donàt specify the window you want to hide, Asymptote hides the currently active
- window. You can also use \f and \r to hide the Data and Recorder Windows respectively.
-
- SEE ALSO:
- $b$showwindow$b$ $b$closewindow$b$
-
- EXAMPLES:
- hide % hide this window
- set test ?You can't see me!
- show % make this window visible again
-
- hidewindow test data % make the window 'test data' invisible
-
- hidewindow \f % hide the current data file window
-
- hidewindow \r % hide the current Recorder Window
- $$if
- expression then command1 [ else command2 ]
- Execute a command based on the result of a logical test
-
- ARGUMENTS:
- expression ± a logical expression resulting in a single value which is either
- true (›0) or false (=0)
- command1 ± the command or macro to execute if the expression is true
- command2 ± the command or macro to execute if the expression is false
-
- DESCRIPTION:
- Use the $b$if$b$ command to control the execution of your scripts based on logical tests.
- For example, if you want to draw the $i$x$i$ and $i$y$i$ points as filled squares only if the
- number of points is greater than 100, you could use:
- if npts 100 > then pointsymbol 4 filled
- plotpoints
- In this example, Asymptote puts the number of points (npts) and the constant 100 on the
- arguments stack. It then compares them with the > operator to produce a result that is
- either true (1) or false (0). If the result is true, Asymptote executes $b$pointsymbol$b$
- to set the point symbol to filled squares.
-
- The logical operators you can use in $b$if$b$ expressions are:
- < less than
- > greater than
- = equal
- <= less than or equal to
- >= greater than or equal to
- <> not equal
- Remember, you don't have to use a logical operator in every expression. Asymptote
- simply evaluates the expression and tests to see if it is true (›0) or false (=0).
-
- Your logical expression must be followed with the word 'then' followed by a command or
- macro name. Optionally, you can follow the command with the keyword 'else' and an
- alternate command to be executed if the logical expression is false. For example the
- command
- if x(10) 34.9 / 10 < then script1 else script2
- executes 'script1' if x(10)/34.9 is less than 10; otherwise 'script2' is executed.
-
- SEE ALSO:
- $b$rpn$b$ $b$repeat$b$ $b$while$b$
-
- EXAMPLES:
- % Draw filled squares if the variable 'drawsquares' is true, else draw open triangles:
- if drawsquares then pointsymbol 4 filled else pointsymbol 3 open
-
- % If the left axis limit is less than 100, set it to be 100 and leave the rest of the
- % axis limits unchanged.
- if xleft 100 < then graphlimits 100 xright ybottom ytop
- $$moveto
- x y
- Move the graph pen to a new x, y coordinate (in graph coordinates)
-
- ARGUMENTS:
- x ± x coordinates of new pen position
- y ± y coordinates of the new pen position
-
- DESCRIPTION:
- Use $b$moveto$b$ to move the graph pen to a new position on your graph. The coordinates
- you specify are measured in graph coordinates. Remember that $b$moveto$b$ only
- positions the pen; it doesn't draw on the graph. Use $b$drawto$b$ if you want to draw a line
- from the old pen position to the new position.
-
- To move the graphics pen using the graph cursor, type
- moveto ?
- in the $i$Command Window$i$, or select Plot>Move To. Asymptote activates the graph cursor
- which you can use to specify the new pen position. When you click the mouse, Asymptote
- enters the $b$drawto$b$ command in your $i$Recorder Window$i$. Using the graph cursor this
- way is particularly useful when you are placing labels on your graph.
-
- SEE ALSO:
- $b$drawto$b$
- $b$cursor$b$
- $b$graphlimits$b$
-
- EXAMPLES:
- moveto 2.0E10 1929.2 % move to (x, y) = (2E10, 1929.2) on the graph
-
- moveto ? % position the pen interactively with the mouse
-
- moveto xleft xright + 2 / ybottom ytop + 2 / % move to the center of the graph
-
- moveto x(10) y(10) 5 + % position the pen 5 units of y above the 10th point
- drawlabel left This is point #10
-
- moveto ? % get the starting position of a line
- drawto ? % draw to a line to this position
- drawarrowto ? % draw and arrow to the next position
-
- moveto ? % move to the starting position
- repeat 10 times drawto ? % draw 10 connected line segments with the mouse
- $$moviefile
- [ filename ]
- Open a new or existing movie file in the $i$Movie Window$i$
-
- ARGUMENTS:
- filename ± the name of the movie file to open
-
- DESCRIPTION:
- To create a new, empty movie file, use $b$moviefile$b$ without an argument. When you
- create a new movie, Asymptote uses the current size of the $i$Graph Window$i$ for the
- dimensions of the movie. To create a movie with a different size, resize the Graph
- Window to the size you want before you create a new movie. To open an existing movie
- file, specify the movie fileàs name after the $b$moviefile$b$ command.
-
- Asymptote opens movie files in the $i$Movie Window$i$. You can play them using the controls
- as the bottom of the $i$Movie Window$i$. You can add a frame to the end of a movie with
- $b$movieframe$b$.
-
- To use the $b$moviefile$b$ command, you must install the QuickTime extension in your
- system. Follow the instructions in Appendix G to install QuickTime if the
- $b$moviefile$b$ command tells you that QuickTime is not installed. If you plan to create
- lots of movies, especially color movies, you may also want to use the Finder to increase
- amount of the memory allocated to Asymptote.
-
- SEE ALSO:
- $b$movieframe$b$
-
- EXAMPLES:
- moviefile % create a new movie file on disk
-
- moviefile MyMovie % open the existing movie ¾MyMovieà in the Movie Window
- $$movieframe
-
- Add a frame to the end of the movie in the $i$Movie Window$i$
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$movieframe$b$ to copy the contents of the $i$Graph Window$i$ to a new frame at the end
- of the movie in the Movie Window.
-
- You can only use $b$movieframe$b$ after you have opened a movie with the $b$movieframe$b$
- command.
-
- SEE ALSO:
- $b$moviefile$b$
-
- EXAMPLES:
- movieframe % add a frame to the end of the movie in the Movie Window
- $$newwindow
-
- Open a new Text Editor Window
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- The $b$newwindow$b$ command, which is the same as selecting File>New, opens a new,
- untitled Text Editor Window. You can use the window to write a script or to enter data.
- To make the new window the $i$Recorder Window$i$, select its name in the File>Recorder
- menu. To make the new window the current $i$Data Window$i$, select its name in the
- File>Data menu.
-
- SEE ALSO:
- $b$closewindow$b$
- $b$hidewindow$b$ $b$showwindow$b$
- $i$Data menu$i$
- $i$Recorder menu$i$
- $$notation
- [ format ]
- Set the notation format labels
-
- ARGUMENTS:
- format ± a value indicating the notation format to use for labels
- decimal (=-2)
- float (=-1)
- general (= 0)
- default (= 1)
- scientific (= 2)
- hhmmss (= 3)
- ddmmss (= 4)
- (see examples below)
-
- DESCRIPTION:
- Use the $b$notation$b$ command to select what notation scheme Asymptote should use
- when converting numbers into labels. The $b$notation$b$ and $b$digits$b$ commands
- work together to select the format and the number of digits that should be displayed.
- If you want to have Asymptote convert numbers to labels automatically, use
- digits 0
- notation general
- If you want greater control over how many decimal places to use or want to force
- Asymptote to use a particular notation, then specify $b$notation$b$ and $b$digits$b$ before
- you draw a label.
-
- Asymptote uses the current value of $b$digits$b$ when it draws labels which contain
- variables or constants. For most notation formats $b$digits$b$ selects the number of
- significant digits you want to display in the number. Use $b$digits$b$= 0 if you want to
- show all the digits in a number. For the 'decimal' notation ($b$notation$b$ = -2),
- $b$digits$b$ specifies how many digits should be printed $i$after$i$ the decimal point.
- With 'decimal' notation set $b$digits$b$ to a large number (say >10) if you want to show
- all digits.
-
- The following examples show how Asymptote converts the value 123.456789 to a label
- using a variety of notation formats.
-
- $b$notation$b$ $b$digits$b$ Label
- decimal 4 123.4568
- 2 123.46
- 0 123
- For the ¾decimalà notation, $b$digits$b$ is the number of digits to display after the decimal
- point. If the value is 0, the ¾decimalà notation displays ¼0.0½ unless $b$digits$b$ is 0, in
- which case a ¼0½ with no decimal point is displayed.
-
- $b$notation$b$ $b$digits$b$ Label
- float 4 123.5
- 2 123
- 0 123.456789
- For the ¾floatà notation, $b$digits$b$ is the number of significant digits to display. The
- float notation always displays ¼0½ if the value is 0.
-
- $b$notation$b$ $b$digits$b$ Label
- general 4 123.5
- 2 123
- 0 123.456789
- The ¾generalà format uses ¾scientificà notation if the value is greater than 1˚x10^6,
- otherwise the ¾floatà notation is used. The general notation always displays ¼0½ if the
- value is 0.
-
- The ¾defaultà notation always uses scientific notation:
- $b$notation$b$ $b$digits$b$ Label
- default 4 1.235˚x˚10^2
- 2 1.2˚x˚10^2
- 0 1.23456789˚x˚10^2
- For the ¾defaultà notation, $b$digits$b$ is the number of significant digits in the mantissa.
- The default notation always displays ¼0½ if the value is 0.
-
- The ¾scientificà notation uses scientific notation:
- $b$notation$b$ $b$digits$b$ Label
- scientific 4 1.235˚x˚10^2
- 2 1.2˚x˚10^2
- 0 1.23456789˚x˚10^2
- For the ¾scientificà notation, $b$digits$b$ is the number of significant digits in the mantissa.
- If the value is 0 and $b$digits$b$is 0, ¾scientificà notation displays ¼0½, otherwise
- ¼0.0½ is displayed.
-
- The ¾hhmmssà notation displays hour, minutes and seconds:
- $b$notation$b$ $b$digits$b$ Label
- hhmmss 4 123h 27m 24.4s
- 2 123h 27m
- 0 123h 27m 24s
- For the ¾hhmmssà notation, if $b$digits$b$ is 0, the time is displayed with no decimal
- point in the seconds portion. If $b$digits$b$ is 1, only the hours are displayed. If
- $b$digits$b$ is 2, the hours and minutes are displayed. If $b$digits$b$ is >3, $b$digits$b$ - 3
- is the number digits to display after the decimal point in the seconds portion
- of the label. If the value is 0, ¼0h½ is always displayed.
-
- The ¾ddmmssà notation displays degrees, minutes and seconds:
- $b$notation$b$ $b$digits$b$ Label
- ddmmss 4 123¡27à 24.4àà
- 2 123¡ 27à
- 0 123¡ 27à 24àà
- For the ¾ddmmss notation, if $b$digits$b$ is 0, the angle is displayed with no decimal
- points in the seconds portion. If $b$digits$b$ is 1, only the degrees are displayed. If
- $b$digits$b$ is 2, the degrees and minutes are displayed. If $b$digits$b$ is >3, $b$digits$b$ - 3
- is the number digits to display after the decimal point in the seconds portion
- of the label. If the value is 0, ¼0¡½ is always displayed.
-
- SEE ALSO:
- $b$digits$b$
- $b$drawlabel$b$
- $b$drawtitle$b$ $b$drawxlabel$b$ $b$drawylabel$b$ $b$drawlabel$b$
-
- EXAMPLES:
- notation scientific
- digits 4
- drawlabel left x(1) % if x(1)= 34.373 label = 3.437 x 10^1
- $$npts
- [ n ]
- Set the number of points to plot or calculate
-
- ARGUMENTS:
- n ± the number of points to plot or use in calculations
-
- DESCRIPTION:
- Use $b$npts$b$ to set the length of the $i$x$i$, $i$y$i$, $i$p$i$, $i$e$i$ and label vectors. When you read data with
- $b$readcolumn$b$ or $b$readrow$b$, Asymptote automatically sets npts to the number of points
- it read. You can use $b$npts$b$ when you are going to calculate values using the $b$rpn$b$
- calculator. With $b$npts$b$, you can choose the number of points to calculate.
-
- If you donàt specify the number of points you want, Asymptote sets the number of points
- to the maximum possible. Note that changing $b$npts$b$ does not change the amount of
- memory devoted to Asymptoteàs vectors. Changing $b$npts$b$ changes the number of
- points that commands like $b$plotline$b$ use when plotting data. To change the maximum
- length of Asymptoteàs vectors use File>Options>Memory˚Use.
-
- SEE ALSO:
- $b$rpn$b$
- $b$datalines$b$
- $b$readcolumn$b$ $b$readrow$b$
- $i$Options$i$
- $i$Memory Use$i$
-
- EXAMPLES:
- % Calculate y= x*x for x= 1 to 100
- npts 100
- rpn index >x dup * >y % index puts the numbers 1 through 100 on the stack
- $$pagesetup
-
- Adjust the page setup
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use the $b$pagesetup$b$ command to read the orientation of the page (landscape or
- portrait) and other page setup information from the current script.
-
- To save the page setup information with a script, first select the script from the
- File>Recorder menu to make it the current Recorder. Next, choose
- File>Graph˚Page˚Setup and configure the graph page setup. To save the page setup to the
- current Recorder, select File>Graph˚Page˚Setup>Save˚to˚Recorder.
-
- To read the graph page setup information from your script, add the command
- pagesetup
- to the script. When Asymptote encounters the $b$pagesetup$b$ command as it executes
- the script, it reads the previously saved page setup information as if you had chosen
- File>Graph˚Page˚Setup from the $i$File$i$ menu.
-
- Remember that when you change the graph page setup information, Asymptote clears the
- graph and erases the contents of the $i$Graph Window$i$. As a result, you should put the page
- setup command at the beginning of your script $i$before$i$ you begin drawing your
- graph.
-
- SEE ALSO:
- $b$print$b$
- $i$File Menu$i$ $i$Graph Page Setup$i$ $i$Save to Recorder$i$
-
- EXAMPLES:
- pagesetup % Read the graph page setup from the Recorder
- DoPlot % Then create the graph by running the script ¾DoPlotà
- print % Print the graph
- $$pencolor
- r g b or colorName
- Set the pen color for graphics and text
-
- ARGUMENTS:
- r, g, b ± red green blue color values in percent
- or
- colorName ± the name of a color
- (red, green, blue, magenta, yellow, purple, black, white)
-
- DESCRIPTION:
- Use $b$pencolor$b$ to change the pen color. There are two ways you can specify the
- color you want. The first is to specify a color by name as in this example:
- pencolor red
- For greater control, you can also specify a combination of red, green and blue that
- produces the color you want. For example, to change the pen color to red use
- pencolor 100 0 0
- You can specify any color you want by its red, green, and blue component intensities.
-
- A handy way to choose the pen color is to use Asymptoteàs color wheel. To use the color
- wheel, type
- pencolor ?
- Or select Set>Pen>Color. Asymptote displays a color wheel so you can select the color
- you want. When you click OK, Asymptote adds the $b$pencolor$b$ command followed
- by the red, green and blue intensities of the color you selected in your Recorder script.
-
- SEE ALSO:
- $b$penpattern$b$
- $b$pensize$b$
- $b$pendash$b$
- $b$fillpattern$b$
- $i$Variables and Constants$i$
-
- EXAMPLES:
- pencolor 50 50 50 % gray
- drawframe % draw a gray frame
-
- pencolor 10 90 25 % a particular color
-
- pencolor ? % Choose a color using a color wheel. Put this command
- % in a script to open the color wheel every time it runs.
- % If you type this command in the $i$Command Window$i$, Asymptote
- displays
- % the color wheel. When you click OK, Asymptote adds the
- pencolor
- % command followed by the r, g, b values of the color you selected
- % to your Recorder script.
- $$pendash
- [ on1 [ off1 ] [ on2 off2 ] [ on3 off3 ] ]
- Set the pen dash pattern (solid, dashed, dotted, etc.)
-
- ARGUMENTS:
- n ± dash pattern lengths (none, 1, 2, 4 or 6 are expected)
- on1 = length of 1st ON segment
- off1 = length of 1st OFF segment
- on2 = length of 2nd ON segment
- off2 = length of 2nd OFF segment
- on3 = length of 3rd ON segment
- off3 = length of 3rd OFF segment
-
- DESCRIPTION:
- Asymptote uses the current pendash pattern when it draws points and lines (except
- when drawing axes). If you don't specify a dash pattern, a solid line is used.
-
- You specify the dash pattern by telling Asymptote the lengths of 6 line segments that
- make up the pattern. The 1st, 3rd and 5th segments are the ¾onà part of the dash
- pattern, while the 2nd, 4th and 6th segments are the lengths of the white space in
- between. You donàt have to specify all of the segments if you donàt want to. If you
- provide only one segment length, Asymptote uses it for all six segments. If you
- want to repeat two segments over for the whole pattern, simply specify the on
- and off segments you want to use.
-
- You can use the Asymptote constants $i$solid$i$, $i$dot$i$, $i$short$i$ and $i$long$i$ to specify the dash pattern
- segments. For example:
-
- pendash short % short dashed lines spaced by a short line segment
-
- pendash long % same thing but long dashed with long spaces
-
- pendash long short % long dashes spaced by short segments
-
- SEE ALSO:
- $b$pensize$b$
- $b$pencolor$b$
- $b$penmode$b$
- $i$Variables and Constants$i$
-
- EXAMPLES:
- pendash dot % draw all subsequent lines as dotted lines
-
- pendash % use solid lines
-
- pendash ? % choose a dash pattern graphically
-
- pendash long dot dot short short short % a dash pattern with all 6 segments specified
-
- pendash 2 1 2 1 4 1 % a particular dash pattern
- $$penmode
- [ n ]
- Set the pen transfer mode for drawing graphics
-
- ARGUMENTS:
- n ± the new pen mode number (1 through 8)
- or
- ± a mode name (opaque, transparent, reversed, erase inverted,
- overlay, clear, whiteout)
-
- DESCRIPTION:
- Use the $b$penmode$b$ command to select a pen drawing mode. The pen mode is a number
- from 1 to 8. For convenience you can use one of the following constants to specify the
- mode you want: opaque, transparent, reversed, erase, inverted, overlay, clear, whiteout.
-
- To choose a mode graphically type:
- penmode ?
- or select Set>Pen>Mode. Asymptote displays a dialog box with an illustration of each pen
- mode. Click the pen mode you want with the mouse.
-
- ¥ Note: PostScript printers don't make use of pen transfer modes. This is a feature of the
- LaserWriter driver supplied by Apple. You can only use pen modes on printers that are
- QuickDraw-based.
-
- SEE ALSO:
- $i$Variables and Constants$i$
- $b$pencolor$b$ $b$pensize$b$ $b$pensize$b$ $b$pendash$b$ $b$penmode$b$
-
- EXAMPLES:
- penmode reversed
- drawpoint % to reverse the pen color where the dot is drawn.
- $$penpattern
- [ penpattern ]
- Set the pen pattern to use when drawing lines
-
- ARGUMENTS:
- penpattern ± a pattern number (0 through 38)
- or
- ± a pattern name (none , black, darkgray, gray, lightgray, white,
- grid, vertical, horizontal, diagonal, white, bricks)
-
- DESCRIPTION:
- Use $b$penpattern$b$ to choose the pattern for pen drawing. The pen pattern is a number
- between 0 and 38. For convenience you can specify one of these named patterns:
- none, black, darkgray, gray, lightgray, white
- grid, vertical, horizontal, diagonal, white, bricks
- To choose the pattern for filling points and polygons, and for shading under curves, use
- the $b$fillpattern$b$ command.
-
- Remember, that although you can use $b$penpattern$b$ to draw dashed lines, it is better to
- use $b$pendash$b$ instead. Lines drawn with dash patterns are true dashed lines: the dash
- pattern follows the curve of the line.
-
- SEE ALSO:
- $i$Variables and Constants$i$
- $b$fillpattern$b$
- $b$pencolor$b$ $b$penmode$b$ $b$pensize$b$ $b$pendash$b$
-
- EXAMPLES:
- % The following commands draw a big, fat, gray X on the graph
- penpattern gray
- pensize 10
- moveto xleft ybottom
- drawto xright ytop
- moveto xleft ytop
- drawto xright ybottom
-
- penpattern gray
- fillpattern black
- pointsymbol 4 filled % Draw filled squares with a gray outline and a black center
- $$pensize
- size
- Set the pen size in points
-
- ARGUMENTS:
- size ± thickness of the pen in points
-
- DESCRIPTION:
- Use $b$pensize$b$ to set the thickness of the pen. Asymptote measures pen sizes in points
- (72 points = 1 inch). To draw hairlines on a LaserWriter, use a pensize of 0.25.
- To 'turn off' the pen, set the pensize to 0. This is useful if you want to draw filled
- polygons or points which arenàt outlined by the pen.
-
- SEE ALSO:
- $b$pencolor$b$ $b$pensize$b$ $b$pendash$b$ $b$penmode$b$ $b$penpattern$b$
-
- EXAMPLES:
- pensize 3 % draw with a pen thickness of 3
- pensize 1 % normal pen thickness (1 point)
- pensize .25 % hairline on a LaserWriter
-
- pensize 0 % hide the pen so it's not visible
- fillpattern gray
- plothistogram % draw a histogram with the pen turned off
- pensize 1 % restore the pen
- $$plotarrows
-
- Connect pairs of points with arrows or line segments
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$plotarrows$b$ to plot arrows connecting pairs of points. To plot line segments
- (rather than arrows between the points) set $b$scale$b$ to 0.0 (with a scale factor of 0.0
- Asymptote doesnàt draw arrow heads).
-
- To use $b$plotarrows$b$ first read the data and store the pairs of points on the calculator
- stack. For example, assume your data file has the ($i$x$i$, $i$y$i$) coordinates of the pairs of
- points arranged in 4 columns (columns 1 and 2 are $i$x$i$ and $i$y$i$ for the start of each line
- segment, and columns 3 and 4 are $i$x$i$ and $i$y$i$ for the end). To read these pairs of points and
- connect them with line segments use:
-
- readcolumn x 1 % read the starting (x,y) positions of the line segments
- readcolumn y 2
- rpn <y <x % push the first pair of (x,y) points on the calculator stack
- readcolumn x 3 % Now read the end points of the lines:
- readcolumn y 4
- rpn <y <x % push the (x,y) end points:
- plotarrows % draw lines that connect the pairs of points on the stack
-
- ¥ Note: If you perform other calculations on the stack, use File>Options>Memory˚Use to
- configure the calculator to hold more than four vectors. If you donàt, your calculations
- may roll off the top of the stack and get lost.
-
- Remember to set $b$cliptoframe$b$ to $i$true$i$ if you donàt want Asymptote to plot any pairs of
- points that extend outside the graph frame.
-
- SEE ALSO:
- $i$Memory Use$i$ $i$Options Menu$i$ $i$File Menu$i$
- $b$readcolumn$b$ $b$readrow$b$
- $b$pendash$b$ $b$penmode$b$ $b$pensize$b$
- $b$pencolor$b$ $b$penpattern$b$
- $b$plotline$b$ $b$plotpoints$b$ $b$plothistogram$b$ $b$ploterrors$b$
- $b$cliptoframe$b$
- $$ploterrors
- direction
- Use the e vector to draw error bars or arrows at each point
-
- ARGUMENTS:
- direction ± the direction of the error bar or limit
- bottom (=1)
- left (=2)
- top (=3)
- right (=4)
-
- DESCRIPTION:
- Use $b$ploterrors$b$ to draw error bars or limit arrows on your graph. First, read the
- length of the error bars into the $i$e$i$ vector or use $b$rpn$b$ to calculate the $i$e$i$ vector.
- Then, use $b$ploterrors$b$ to draw the error bar in the direction you want. To
- draw an arrow (to indicate a limit) rather than an error bar at a point, put a negative
- value in the $i$e$i$ vector for that point. Use $b$scale$b$ to adjust the size of the crosses or arrow
- heads on the end of the error bars. Set $b$scale$b$ to 0 if you don't want crosses or arrow
- heads.
-
- You can use $b$ploterrors$b$ repeatedly to draw error bars in all four directions from each
- point. Because you can read a different set of error bar data each time you use
- $b$ploterrors$b$, you can draw error bars with different lengths or limits in each of the
- four directions. This makes it possible to draw correct error bars on log-log or
- semi-log graphs.
-
- Remember to set $b$cliptoframe$b$ to $i$true$i$ if you donàt want your error bars to extend
- outside the graph frame.
-
- SEE ALSO:
- $b$scale$b$
- $b$readcolumn$b$ $b$readrow$b$
- $b$plotline$b$ $b$plotpoints$b$ $b$plothistogram$b$ $b$plotarrows$b$
- $b$cliptoframe$b$
-
- EXAMPLES:
- readcol x 1 % read the x and y data
- readcol y 2
- graphlimits
- plotline
- readcolumn e 3 % read the error in x
- ploterrors right % plot the +x error bars
- ploterrors left % plot the -x error bars (same as +x)
- readcolumn e 4 % read positive y error
- ploterrors top % plot the +y direction error bars
- readcolumn e 5 % read negative y error
- ploterrors bottom % plot the -y direction errors (different than +y)
-
- ploterrors ? % Choose the direction graphically
- $$plothistogram
- [ level ]
- Draw the (x, y) points as a histogram
-
- ARGUMENTS:
- level ± the baseline level of the histogram
-
- DESCRIPTION:
- Use $b$plothistogram$b$ to draw the data in the $i$x$i$ and $i$y$i$ vectors as a histogram. If you
- need to calculate the histogram of your data first, use $b$binxy$b$ then issue the
- $b$plothistogram$b$ command. If your $i$x$i$ and $i$y$i$ data are not in order, you can use
- $b$sort$b$ before plotting the histogram.
-
- The optional argument to $b$plothistogram$b$ is the baseline level. If you specify the
- baseline, $b$plothistogram$b$ fills the area between the baseline level and the histogram
- using the current $b$fillpattern$b$ and $b$pencolor$b$. If you don't supply the baseline
- level, $b$plothistogram$b$ just draws the histogram and doesn't fill the area underneath.
-
- Remember to set $b$cliptoframe$b$ to $i$true$i$ if you donàt want Asymptote to draw parts of the
- histogram that may extend outside the graph frame.
-
- SEE ALSO:
- $b$binxy$b$ $b$sort$b$
- $b$fillpattern$b$ $b$pencolor$b$
- $b$plotline$b$ $b$plotpoints$b$ $b$ploterrors$b$ $b$plotarrows$b$
- $b$cliptoframe$b$
-
- EXAMPLES:
- readcol x 3 % read the data
- binxy 100 % calculate a histogram of 100 bins
- graphlimits % scale the graphlimits to fit it all in
- plothistogram % plot it without filling underneath
- drawframe
-
- plothistogram 0.0 % fill underneath the histogram with the current fill
- % pattern and color with a baseline of y= 0.0
- $$plotlabels
- [ position ]
- Plot the labels in the label vector at each point
-
- ARGUMENTS:
- position ± the position of the labels relative to each point:
- aboveleft (=7) above (=8) aboveright (=9)
- centerleft (=4) center (=5) centerright (=6)
- belowleft (=1) below (=2) belowright (=3)
-
- DESCRIPTION:
- To plot labels at each ($i$x$i$, $i$y$i$) point, first read the labels into the $i$l$i$ vector with the
- $b$readcolumn$b$ or $b$readrow$b$ commands. Then, use $b$plotlabels$b$ and specify how you
- want Asymptote to position the labels relative to each point. You can use $b$fontname$b$ and
- $b$scale$b$ to choose the font and size of the labels and $b$rotation$b$ to rotate them about each
- point.
-
- Remember to set $b$cliptoframe$b$ to $i$true$i$ if you donàt want Asymptote to plot labels that
- lie outside the graph frame.
-
- SEE ALSO:
- $i$Variables and Constants$i$
- $b$readcolumn$b$ $b$readrow$b$
- $b$fontname$b$ $b$scale$b$ $b$rotation$b$
- $b$plotline$b$ $b$plotpoints$b$ $b$plothistogram$b$ $b$ploterrors$b$
- $b$plotarrows$b$
- $b$cliptoframe$b$
-
- EXAMPLES:
- readrow x 2 % read x, y and the labels from rows 2,3,4 of the data file
- readrow y 3
- readrow l 4
- fontname helvetica
- graphlimits
- plotlabels aboveleft % draw the labels
- plotpoints % draw the points
- drawframe % add a fame
-
- plotlabels ?
- $$plotline
-
- Plot a line by connecting the (x, y) data points
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$plotline$b$ to connect your ($i$x$i$, $i$y$i$) points with a line. Like all other plotting
- commands, $b$plotline$b$ uses the current pen properties to draw the line. If your $i$x$i$ data
- are in a random order, you may want to use $b$sort$b$ in order to plot a line that moves from
- left to right or right to left in $i$x$i$.
-
- Remember to set $b$cliptoframe$b$ to $i$true$i$ if you donàt want Asymptote to plot segments of
- the line that extend outside the graph frame.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$plotpoints$b$ $b$ploterrors$b$ $b$plothistogram$b$ $b$plotpolygon$b$
- $b$plotlabels$b$
- $b$pendash$b$ $b$penmode$b$ $b$pensize$b$
- $b$pencolor$b$ $b$penpattern$b$
- $b$sort$b$
- $b$cliptoframe$b$
-
- EXAMPLES:
- readcolumn x 2 % x data are in column 2
- readcolumn y 3 % y data are in column 3
- graphlimits % automatic limits
- plotline
- drawframe
- $$plotpoints
-
- Draw points at all (x, y) points
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$plotpoints$b$ to plot a symbol at each ($i$x$i$, $i$y$i$) point. You can make the symbols
- larger or smaller with the $b$scale$b$ command, and you can rotate them with the
- $b$rotation$b$ command. Asymptote uses the current pen properties such as $b$pensize$b$,
- $b$pencolor$b$ and $b$penpattern$b$ when drawing the point symbols. The current $b$fillpattern$b$,
- if any, is the fill pattern Asymptote uses for filled points.
-
- To plot the same symbol at each point, use $b$pointsymbol$b$ to specify the symbol you
- want to plot. Alternatively you can plot different symbols at each point using
- information in your data file. To do this, see the description of how to read point
- symbols with $b$readcolumn$b$ or $b$readrow$b$.
-
- Remember that $b$cliptoframe$b$ must be set to $i$true$i$ if you donàt want Asymptote to plot
- any points that lie outside the graph frame.
-
- SEE ALSO:
- $b$readcolumn$b$ $b$readrow$b$
- $b$pointsymbol$b$ $b$scale$b$ $b$rotation$b$
- $b$pendash$b$ $b$penmode$b$ $b$pensize$b$
- $b$pencolor$b$ $b$penpattern$b$ $b$fillpattern$b$
- $b$plotline$b$ $b$plotpoints$b$ $b$plothistogram$b$ $b$ploterrors$b$
- $b$plotarrows$b$
- $b$cliptoframe$b$
-
- EXAMPLES:
- readcolumn x 1 % x data are in column 1
- readcolumn y 4 % y data are in column 2
- graphlimits % automatic limits
- plotpoints
- $$plotpolygon
- [ Closed [ Baseline ]]
- Connect the (x, y) points to form a polygon
-
- ARGUMENTS:
- Closed ± if true, connect the end points of the polygon
- Baseline ± if specified, connect the end points to this baseline
-
- DESCRIPTION:
- Use $b$plotpolygon$b$ to connect the ($i$x$i$, $i$y$i$) points to form a polygon. Asymptote uses the
- current fillpattern and pen characteristics to draw and fill the polygon. The two optional
- arguments to $b$plotpolygon$b$ allow you to close the polygon by connecting its end points.
- If you specify $i$true$i$ for the first argument, $b$plotpolygon$b$ connects the end points of the
- curve. If you also supply the second argument, the baseline level, Asymptote connects
- the end points of the polygon to the baseline. This option is useful when you want to
- fill under a curve with a pattern. For example, setting the baseline to 0.0 shades the
- integral under a curve.
-
- Remember to set $b$cliptoframe$b$ to $i$true$i$ if you donàt want Asymptote to plot any part of
- the polygon that extends outside the graph frame.
-
- SEE ALSO:
- $b$pencolor$b$ $b$penpattern$b$ $b$fillpattern$b$
- $b$pendash$b$ $b$penmode$b$ $b$pensize$b$
- $b$readcolumn$b$ $b$readrow$b$
- $b$plotline$b$ $b$plotpoints$b$ $b$plothistogram$b$ $b$ploterrors$b$
- $b$plotarrows$b$
- $b$cliptoframe$b$
-
- EXAMPLES:
- readcolumn x 1 % x data are in column 1
- readcolumn y 2 % y data are in column 2
- graphlimits % automatic limits
- fillpattern black
- pencolor blue
- plotpoly
- plotpoly % connect the x, y points to form a polygon
-
- plotpolygon closed % connect the end points to each other
-
- penpattern none % turn off the pen
- fillpattern gray % set to fill with gray
- plotpoly closed 0.0 % fill under (or up to) y= 0.0 with gray
- penpattern black % turn the pen back on
- pensize 4 % make it thick
- plotpoly open % draw a thick black line for the actual data
- $$pointsize
- points
- Set the point symbol to use when drawing points
-
- ARGUMENTS:
- points ± point size when scale = 1.0 (in points)
-
- Use $b$pointsize$b$ to set the size (in points) that you want Asymptote to use for points
- when the scale factor is set to 1.0. The $b$pointsize$b$ command is a handy way to adjust
- the size of your point symbols without having to change $b$scale$b$ every time you draw
- points. The default point size is 6 points. You may want to add the $b$pointsize$b$
- command to your Start Up script if you want to change this default.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$pointsymbol$b$ $b$plotpoints$b$
-
- EXAMPLES:
- pointsize 6 % set the point size to 6 points
- scale 1
- plotpoints % draw points that are 6 points in diameter
- scale 2
- plotpoints % draw 12 pt points
- $$pointsymbol
- nsides style
- Set the point symbol to use when drawing points
-
- ARGUMENTS:
- nsides ± the number of sides for polygon
- style ± the style
- open (=0)
- cross (=1)
- star (=2)
- filled (=3)
-
- DESCRIPTION:
- Use $b$pointsymbol$b$ to choose which symbol Asymptote uses to plot points on your
- graph. To plot the same symbol at each point, first use $b$pointsymbol$b$ to specify the
- point symbol you want, and then use $b$plotpoints$b$ to plot the points. Point symbols
- in Asymptote are drawn as regular polygons that are either open (connect the vertices of
- the polygon), or filled (same as open but fill the polygon with the current fill pattern),
- drawn as a cross (connect the vertices to the center of the point), or drawn as a star
- (connect the vertices to a mid-point).
-
- To draw different symbols at each point, use the $b$readcolumn$b$ or $b$readrow$b$
- commands to read the point symbols from a file, or use $b$rpn$b$ to calculate the symbol
- to use at each point. See the description of the $b$readrow$b$ and $b$readcolumn$b$
- commands for more information about how to read point symbols from a file.
-
- You can shrink or enlarge the points with the $b$scale$b$ command or you can change the
- default point size with $b$pointsize$b$. Change the color of points with $b$pencolor$b$ and
- their fill patterns with $b$fillpattern$b$. You can also rotate points with $b$rotation$b$
- (to draw, for example, diamonds rather than squares).
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$pencolor$b$ $b$pensize$b$ $b$penpattern$b$ $b$penmode$b$
- $b$fillpattern$b$ $b$scale$b$ $b$rotation$b$ $b$pointsize$b$
- $b$readcolumn$b$ $b$readrow$b$
-
- EXAMPLES:
- pointsymbol 4 filled % set the point symbol to filled squares
- fillpattern gray
- pencolor red
- plotpoints
-
- readcolumn x 1 % read x data from column 1
- readcolumn y 2 % read first set of y data from column 2
- pointsymbol 3 filled % choose filled triangles
- plotpoints % plot the points
- readcolumn y 3 % read the second set of y data from column 3
- rotation 180 % set the rotation angle to 180 degrees
- plotpoints % draw the second set of points with upside down triangles
- $$print
-
- Print the current graph
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Issue the $b$print$b$ command to print your graph on the printer selected in the Chooser.
- The Chooser is located in the $i$Apple$i$ menu.
-
- You can put the $b$print$b$ command in a script to generate plots and print them
- automatically. This feature even works in the background under MultiFinder or
- System 7 so you can send your graphs to the printer while you do other work. To
- fully automate your printing, you can also save the page setup in your script. Your
- script can then specify the page setup with the $b$pagesetup$b$ command. See the
- description of $b$pagesetup$b$ for more information.
-
- SEE ALSO:
- $b$pagesetup$b$
- $b$run$b$
-
- EXAMPLES:
- pagesetup ? % Ask for the pagesetup
- readcolumn x 1 % Read the data...
- readcolumn y 2
- graphlimits
- drawframe
- plotline % ... and plot a line
- print % Print the graph
-
- pagesetup % Read a previously saved page setup from this script
- readcol x 1
- readcol y 2
- graphlimits
- drawframe
- plotpoints
- print % Print the graph
- $$publish
-
- Publish the current graph
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$publish$b$ to publish the current contents of the $i$Graph Window$i$ in a PICT format
- edition file. If you havenàt saved the $i$Graph Window$i$ to a publication, Asymptote displays
- the Edit>Create˚Publisher dialog box where you can name the new publication. If the
- $i$Graph Window$i$ already is a publisher, the publish command updates the publisher with
- the current contents of the $i$Graph Window$i$. This has the same effect as selecting
- Edit>Publisher˚Options and then clicking the Publish Now button.
-
- For a detailed description Asymptoteàs Publish and Subscribe features, see Appendix E
- of the Asymptote $i$User's Guide$i$.
-
- SEE ALSO:
- $b$print$b$
-
- EXAMPLE:
- publish
- $$quit
-
- Quit Asymptote and return to the Finder
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$quit$b$ just as you would use File>Quit. When you quit, Asymptote checks to see if
- you have saved changes you made to text files. If you havenàt, Asymptote asks you if you
- want to save the changes before quitting.
-
- You can put the $b$quit$b$ command at the end of a script to have Asymptote quit automatically
- when it reaches the end of the script.
-
- EXAMPLE:
- readcolumn x 1
- readcolumn y 2
- graphlimits
- drawframe
- plotline
- print % send the plot to the printer
- clear % erase the graph so Asymptote won't ask if you want to save it
- quit % quit and return to the Finder
- $$readcolumn
- vectorName n
- Read a column of numbers into one of Asymptoteàs vectors
-
- ARGUMENTS:
- vectorName ± the name of the vector ($i$x$i$, $i$y$i$, $i$e$i$, $i$p$i$, or $i$l$i$) to store the data
- n ± the column number to read from the data file
-
- DESCRIPTION:
- Use $b$readcolumn$b$ to read a column of numbers or labels from your data file into one
- of Asymptoteàs vectors. Before you read the data, you must first specify which data file
- to use with $b$datafile$b$. If you want, you can use $b$datalines$b$ to specify which lines
- you want to read. If the columns of numbers in your data file are not separated by spaces,
- commas or tabs, you may want to use $b$datacolumns$b$ to specify how to read the $i$y$i$ data.
- See the description of $b$datacolumns$b$ for more information about this feature.
-
- READING NUMBERS FROM A DATA FILE:
- To read numbers from your data file into one of Asymptoteàs vectors, simply type the
- name of the vector and number of the column you want to read following the
- $b$readcolumn$b$ command. If you donàt know the number of the column you want, click the
- column and select Data>Read˚Data>From˚Column. Asymptote displays a dialog box and
- enters the number of the column you selected.
-
- READING LABELS FROM A DATA FILE:
- With Asymptote you can read text labels for your points and plot a different label for
- each point on your graph. First, read the coordinates of the points with readcolumn x
- and readcolumn y, then read the point labels with readcolumn l. If your labels include
- spaces, commas or tabs, you must enclose them in quotes. Use two quotes ("") if you
- need to insert a quote in a label.
-
- In the following example, a portion of the data file looks like this:
-
- 1.1 21 Fred 34.3
- 1.2 22 Hi! 343.0
- 1.3 23 "1,2,3" 343.0
- 1.4 24 "How are you?" 29.2
- 1.5 25 ""OK,"" he said." 19.2
-
- As with all Asymptote data files, you don't need to align the columns of the data file as
- they appear in this example. Just be sure that each row contains enough entries and
- that each entry is separated with spaces, a comma or a tab.
-
- You could read the points and their labels with the following commands:
- readcolumn x 1
- readcolumn y 2
- graphlimits % show all of the points
- plotpoints % plot 'em
-
- % select a font for the labels:
- font Helvetica
- readcolumn l 3 % read the labels
- plotlabels aboveleft % plot the labels
-
- The above example plots the points using the current $b$pointsymbol$b$, and places the
- labels above and to the left of each point. It uses $b$fontname$b$ to select the font for the
- labels before plotting them with $b$plotlabels$b$. You could insert a $b$scale$b$ command
- before calling $b$plotlabels$b$ to adjust the size of the labels or a $b$rotation$b$ command
- to rotate them about each point.
-
- READING POINT SYMBOLS FROM A DATA FILE:
- You can use $b$readcolumn$b$ to read point symbols from your data file in order to plot a
- different symbol at each point.
-
- The number of sides and the style of each point in the $i$p$i$ vector must be combined into a
- single number as follows:
-
- Tens and
- Hundreds digits: number of sides for the point
-
- Ones digit: point style (open, cross, star, filled)
-
- Fractional part: scale factor
-
- Sign: if negative, rotate by (180/number of sides)¡
-
- For example, a value of -43.5 in the $i$p$i$ vector produces a filled square, 0.5 times
- smaller than the current scale factor which is rotated by 45¡.
-
- If a value in the $i$p$i$ vector for a particular point is zero, Asymptote wonàt plot it. You
- can use this feature to select the points to plot based on some information in your data
- file. For example, to plot all points which have a value in the $i$e$i$ vector greater than
- 100, you could use the following commands:
-
- rpn <e 100 > % leave 1's and 0's on the stack if e > 100
- rpn <p * >p % zero all the p vector elements with e < 100
-
- You can also use $b$rpn$b$ to calculate the point symbols for the $i$p$i$ vector. For example,
- suppose your data file contains the following information about some automobiles:
-
- Column Value
- 1 miles per gallon
- 2 weight
- 3 4, 6, or 8 cylinders
- 4 horse power
-
- To plot miles per gallon $i$vs.$i$ weight, using filled triangles, squares and circles for 4, 6,
- or 8 cylinders respectively, you could use these commands:
-
- readcolumn x 1 % read the x values
- readcolumn y 2 % read the y values
- readcolumn p 3 % read the p values (= 4,6 or 8)
- rpn <p 8 = 15 * % replace all 8's with 15 (for circles)
- rpn <p 6 = 4 * + % replace all 6's with 4's (for squares)
- rpn <p 4 = 3 * + % replace all 4's with 3's (for triangles)
- rpn 10 * % multiply by 10 to put 30,40 or 150 on the stack
- rpn 3 + >p % make the point filled (33,43,153)
-
- To plot only the automobiles that have a horse power greater than 100 add the following
- commands before plotting the points with $b$plotpoints$b$:
-
- rpn <p % save the point symbols on the calculator stack
- readcolumn p 4 % read horse power data into the p vector
- rpn <p 100 > % if horse power > 100, leave 1 on stack, else 0
- rpn * >p % multiply the previously saved points symbols and
- % store the new point symbols in the $i$p$i$ vector
-
- Note that this example uses the calculator stack to temporarily hold the point symbols in
- order to read the horse power data in to the $i$p$i$ vector.
-
- Alternatively you could scale the size of each point based on the horse power of the car
- with the following commands:
-
- rpn <p % save the point symbols on the stack
- readcolumn p 4 % read horse power into p vector
- rpn <p dup max 1 + / % divide p vector by 1 + its maximum
- rpn + >p % add the fractional part to the original p vector
- % which was saved on the stack
-
- Finally, you could rotate all of the points which had a horse power of 120 or greater
- with the following commands:
-
- rpn <p % save the point symbols on the stack
- readcolumn p 4 % read horse power into p vector
- rpn <p 120 > % put 1 on the stack if horse power > 120, else 0
- rpn -2 * 1 + % now, -1 if horse power >120, 1 if not
- rpn * >p % make all horse power >120 p vector values negative
-
- SEE ALSO:
- $b$readrow$b$
- $b$datafile$b$ $b$datalines$b$ $b$datacolumns$b$
-
- EXAMPLE:
- datafile 1990 data % Open the data file "1990 data"
- datalines 10 100 % use only lines 10 through 100
- readcolumn y 3 % read these values from column 3 of the file into y
- $$readcursor
- [ delay ]
- Use the graph cursor to read values into the x and y vectors
-
- ARGUMENTS:
- delay ± 1/60th of a second to delay between reading points when the
- mouse button is held down (0 = read a single point with each click)
-
- DESCRIPTION:
- With $b$readcursor$b$ you can read points from your graph using the graph cursor and store
- the values in the $i$x$i$ and $i$y$i$ vectors. When you issue the $b$readcursor$b$ command, Asymptote
- activates the graph cursor. If you specify a delay following the $b$readcursor$b$ command,
- Asymptote begins reading a stream of values from your graph as soon as you press and
- hold down the mouse button. The delay argument controls how many 1/60ths of a second
- to wait between reading points in the stream. If you don't specify a delay (or you
- give 0 for the delay) Asymptote reads only one point with every click of the mouse.
-
- To stop reading points, hold down the command and period keys or click outside the
- $i$Graph Window$i$.
-
- SEE ALSO:
- $b$export$b$
-
- EXAMPLE:
- showgraph
- readcursor
- plotpoints
- $$readrow
- vectorName n
- Read a row into one of Asymptoteàs vectors
-
- ARGUMENTS:
- vectorName ± the name of the vector ($i$x$i$, $i$y$i$, $i$e$i$, $i$p$i$, or $i$l$i$) to store the data
- n ± the row number to read from the data file
-
- DESCRIPTION:
- Use $b$readrow$b$ to read a row of numbers from your data file into one of Asymptoteàs
- vectors. Before you read the data, you must first specify which data file to use with
- $b$datafile$b$. If you donàt want to read all of the values in a row, use $b$datacolumns$b$
- to specify which columns you want.
-
- READING NUMBERS FROM A DATA FILE:
- To read numbers from your data file into one of Asymptoteàs vectors, simply type the
- name of the vector and number of the row you want to read following the $b$readrow$b$
- command. If you donàt know the number of the row you want, click the row then select
- Data>Read˚Data>From˚Row. Asymptote displays a dialog box and enters the number of
- the row you selected.
-
- READING LABELS FROM A DATA FILE:
- With Asymptote you can read text labels for your points and plot a different label for
- each point on your graph. First, read the coordinates of the points with readrow x
- and readrow y, then read the point labels with readrow l. If your labels include spaces,
- commas or tabs, you must enclose them in quotes. Use a two quotes ("") if you need to
- insert a quote in a label.
-
- For example, assume that your data file looks like this:
-
- Fred Hi! "1,2,3" "How are you?" ""OK,"" he said.""
- 1.1 1.2 1.3 1.4 1.5
- 21 22 23 24 25
-
- As with all Asymptote data files, the columns of the file don't need to be aligned as they
- are in this example. Just be sure that each row contains the required number of
- items and that each entry is separated by spaces, a comma or a tab.
-
- To plot the points and their labels from this data file use the following commands:
-
- readrow x 1
- readrow y 2
- graphlimits % show all the points
- plotpoints
- font Helvetica
- readrow l 3
- plotlabels aboveleft
-
- This example plots the points using the current $b$pointsymbol$b$, and places the labels
- above and to the left of each point. It uses $b$fontname$b$ to select the font for the labels
- before plotting them with $b$plotlabels$b$. You could insert a $b$scale$b$ command before
- using $b$plotlabels$b$ to adjust the size of the labels or a $b$rotation$b$ command to rotate
- them about each point.
-
- READING POINT SYMBOLS FROM A DATA FILE:
- You can use $b$readrow$b$ to read point symbols from your data file in order to plot a
- different symbol at each point.
-
- The number of sides and the style of each point in the $i$p$i$ vector must be combined
- into a single number as follows:
-
- Tens and Hundreds digits: number of sides for the point
-
- Ones digit: point style (open, cross, star, filled)
-
- Fractional part scale factor
-
- Sign if negative, rotate by (180/number of sides)¡
-
- For example, a value of -43.5 in the $i$p$i$ vector produces a filled square, 0.5 times
- smaller than the current scale factor which is rotated by 45¡.
-
- If a value in the $i$p$i$ vector for a particular point is zero, Asymptote wonàt plot it. You
- can use this to select the points to plot based on some information in your data file. For
- example, to plot all points which have a value in the $i$e$i$ vector greater than 100, you
- could use the following commands:
-
- rpn <e 100 > % leave 1's and 0's on the stack
- rpn <p * >p % zero all the p vector elements with e < 100
-
- You can also use $b$rpn$b$ to calculate the point symbols in the $i$p$i$ vector. For example,
- suppose your data file contains the following information about some automobiles:
-
- Row Value
- 1 miles per gallon (MPG)
- 2 weight
- 3 4, 6, or 8 cylinders
- 4 horse power
-
- To plot lot MPG $i$vs.$i$ weight, using filled triangles, squares and circles for 4, 6 or 8
- cylinders, you could use the following commands:
-
- readrow x 1 % read the x values
- readrow y 2 % read the y values
- readrow p 3 % read the p values(4,6 or 8)
- rpn <p 8 = 15 * % replace all 8's with 15 (for circles)
- rpn <p 6 = 4 * + % replace all 6's with 4's (for squares)
- rpn <p 4 = 3 * + % replace all 4's with 3's (for triangles)
- rpn 10 * % now we have 30,40 or 150 on the stack
- rpn 3 + >p % add 3 to make them filled (33,43,153)
-
- To plot only the automobiles that had a horse power greater than 100 add the following
- commands before plotting the points with $b$plotpoints$b$:
-
- rpn <p % save the point symbols on the stack
- readrow p 4 % read horse power data into the p vector
- rpn <p 100 > % if horse power>100, leave 1 on stack, else 0
- rpn * >p % multiply the previously saved point symbols
- % and store the new point symbols
-
- Notice that this example uses the calculator stack to temporarily hold the point symbols
- in order to read the horse power data in to the $i$p$i$ vector.
-
- Alternatively, you could scale the size of each point based on the horse power of the car
- with the following commands:
-
- rpn <p % save the point symbols on the stack
- readrow p 4 % read horse power into p vector
- rpn <p dup max 1 + / % divide p vector by 1 + its maximum
- rpn + >p % add the fractional part to the original
- % $i$p$i$ vector which was saved on the stack
-
- Finally, you could rotate all of the points which had a horse power of 120 or greater
- with the commands:
-
- rpn <p % save the point symbols on the stack
- readrow p 4 % read horse power into p vector
- rpn <p 120 > % put 1 on the stack if horse power>120,else 0
- rpn -2 * 1 + % now, -1 if horse power >120, 1 if not
- rpn * >p % make the p vector values negative if horse power > 120
-
- SEE ALSO:
- $b$readcolumn$b$
- $b$datafile$b$ $b$datalines$b$ $b$datacolumns$b$
-
- EXAMPLE:
- datafile 1990 data % Open the data file "1990 data"
- datacolumns 2 11 % skip the first item and read the next 10 items
- readrow x 3 % read these values from column 3 of the file into x
- $$repeat
- expression times command
- Repeat a command (or run a script) several times
-
- ARGUMENTS:
- expression ± an expression for the number of times to repeat the command or script
- command ± the command or script to repeat
-
- DESCRIPTION:
- Use $b$repeat$b$ to execute a script or a command a specified number of times. Following
- the $b$repeat$b$ command you must provide an expression that evaluates to a single number.
- This expression is the number of times to repeat the command or script. After the
- expression, type the word 'times' followed by the command or script you want to run.
-
- SEE ALSO:
- $b$while$b$
- $b$if$b$
-
- EXAMPLES:
- repeat 5 times myscript % execute the script ¾myscriptà 5 times
-
- set nloops npts 2 / % nloops = half the number of points
- repeat nloops scaledata 2 3 npts % run the script 'scaledata' nloops times
- % with 2, 3 and npts as arguments to 'scaledata'
- repeat npts 2 / scaledata 2 3 npts % Same as the above
-
- rpn 1 % put the constant vector 1 on the stack
- repeat 5 times rpn 2 * % calculate the powers of 2 from 1 to 5
-
- repeat npts 1 - times myscript % repeat 'myscript' npts - 1 times
- $$return
-
- Stop the current script and return to the script that ran the current script
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Use $b$return$b$ in a script when you want to stop executing the current script and return
- to the script that ran the current script (if any). For example, you might return from
- a script if a certain condition is met as in the following example:
- set NumLeftToDo NumLeftToDo 1 -
- if NumLeftToDo 0 <= then return
- In this example, Asymptote returns from the script if the variable NumLeftToDo is 0 or
- less. When this happens, the commands following the $b$if$b$ test are not run.
-
- Note: The $b$return$b$ command can only be executed from a script. You can't execute
- $b$return$b$ from the $i$Command Window$i$.
-
- SEE ALSO:
- $b$stop$b$ $b$pause$b$ $b$quit$b$
-
- EXAMPLES:
- ask Continue Yes No ?Do you want to process another data set?
- if Continue false = then return
-
- if beta 34 * < alpha then return else calculate_next_alpha
- $$rotation
- degrees
- Set the rotation angle for labels and points
-
- ARGUMENTS:
- degrees ± the angle in degrees, counter clock wise from x axis
-
- DESCRIPTION:
- Use $b$rotation$b$ to specify how Asymptote should rotate labels and points. The rotation
- angle you supply is measured in degrees, counter-clockwise from the $i$x$i$ (horizontal)
- axis. A rotation angle of 0¡ points to the right. A rotation of 90¡ points up the page.
-
- SEE ALSO:
- $b$drawlabel$b$
- $b$plotlabels$b$
- $b$plotpoints$b$ $b$pointsymbol$b$
-
- EXAMPLES:
- readcolumn x 1
- readcolumn y 2 % read the first set of y points
- pointsymbol 3 filled % filled triangles for points
- plotpoints
- readcolumn y 3 % read some other data
- rotation 180
- plotpoints % draw the triangles upside down
-
- graphlimits 0 1 0 1
- moveto .5 .5
- rotation 45
- drawlabel right This is a rotated label
- $$rpn
- expression
- Use the vector calculator to calculate a reverse polish notation (RPN) expression
-
- ARGUMENTS:
- expression ± a RPN expression (see below)
-
- DESCRIPTION:
- Use $b$rpn$b$ to access Asymptote's powerful vector calculator. You might use $b$rpn$b$ to
- calculate a formula, to manipulate the data before plotting, or to calculate point symbols
- for use by the $b$plotpoints$b$ command.
-
- If you are not familiar with reverse polish notation, read Appendix D. The easiest way to
- write an $b$rpn$b$ expression is to use the $i$Calculator˚Window$i$. As you perform calculations
- in the $i$Calculator Window$i$, Asymptote writes the appropriate $b$rpn$b$ expressions for you.
- You can use the $i$Vectors˚Window$i$ to examine the calculator stack and the values in
- Asymptote's vectors.
-
- To enter a constant in an expression, simply type its value and press the Enter key.
- Asymptote $i$pushes$i$ the value on the bottom of the calculator stack. The other vectors
- on the stack are pushed up. When $b$rpn$b$ encounters a binary operator (operators such
- as +,-,/,*), it $i$pops$i$ two values off the bottom of the stack, performs a calculation and
- pushes the result on the bottom of the stack. For unary operators (for example rms,
- sqrt or sin), $b$rpn$b$ replaces the bottom vector of the stack with the results of the
- calculation.
-
- The calculator stack has a depth of at least 4 (that means it can remember the last 4
- vectors you pushed). You can use File>Options>Memory˚Use to add more vectors to the
- calculator stack or allocate more registers to use in your calculations. The following
- table lists all of the $b$rpn$b$ operators and functions:
-
- $b$RPN CALCULATOR OPERATORS$b$
- stack x = bottom vector on the stack (not the x vector)
- stack y = 2nd to the bottom vector on the stack (not the y vector)
-
- In the $i$Vectors Window$i$ the vectors on the stack are numbered 0 through 3. The vector
- labeled ¾Stack 0à is stack x, the vector labeled ¾Stack 1à is the same as y).
-
- ___ $i$Store/Recall Operators$i$ _____________________________________________
- The following operators push an Asymptote vector onto the bottom of the stack:
- <x push the $i$x$i$ vector onto the bottom of the stack (stack x)
- <y push the $i$y$i$ vector onto the bottom of the stack (stack x)
- <p push the $i$p$i$ vector onto the bottom of the stack (stack x)
- <e push the $i$e$i$ vector onto the bottom of the stack (stack x)
- <rn push the register n onto the bottom of the stack (stack x)
-
- The following commands copy stack $i$x$i$ into one of Asymptoteàs vectors. They do not alter
- the calculator stack:
- >x store stack $i$x$i$ in the $i$x$i$ vector
- >y store stack $i$x$i$ in the $i$y$i$ vector
- >p store stack $i$x$i$ in the $i$p$i$ vector
- >e store stack $i$x$i$ in the $i$e$i$ vector
- >rn store stack $i$x$i$ in register n
-
- ___ $i$Stack Operators$i$ __________________________________________________
- The following operators manipulate the stack:
- dup duplicate stack $i$x$i$
- drop pop stack $i$x$i$ off the stack and drop the stack down
- xy swap stack $i$x$i$ and stack $i$y$i$
- cx clear stack $i$x$i$ (replace stack $i$x$i$ with zeros)
- rad switch to radians for subsequent calculations
- deg switch to degrees for subsequent calculations
-
- ___ $i$Logical Operators$i$ _______________________________________________________
- The following operators pop two vectors off the stack, compare them with a logical test,
- and push the results of the test with a vector of 1às and 0às (true or false).
- = push 1 if x = y, else 0
- <> or › push 1 if x › y, else 0
- < push 1 if x < y, else 0
- > push 1 if x > y, else 0
- <= push 1 if x <= y, else 0
- >= push 1 if x >= y, else 0
-
- ___ $i$Unary Operators$i$ _____________________________________________________________
- The following operators pop stack x, calculate something with it, and push the result on
- the stack:
- ! replace stack $i$x$i$ with its factorial
- chs replace stack $i$x$i$ with -$i$x$i$
- int replace stack $i$x$i$ with integer portion of $i$x$i$
- frac replace stack $i$x$i$ with fractional portion of $i$x$i$
- abs replace stack $i$x$i$ with absolute value of $i$x$i$
- sqrt replace stack $i$x$i$ with square root of $i$x$i$
- sin replace stack $i$x$i$ with sine of $i$x$i$ (units set by rad/deg)
- cos replace stack $i$x$i$ with cosine of $i$x$i$ (units set by rad/deg)
- tan replace stack $i$x$i$ with tangent of $i$x$i$ (units set by rad/deg)
- asin replace stack $i$x$i$ with arcsine of $i$x$i$ (units set by rad/deg)
- acos replace stack $i$x$i$ with arccosine of $i$x$i$ (units set by rad/deg)
- atan replace stack $i$x$i$ with arctan of $i$x$i$ (units set by rad/deg)
- log replace stack $i$x$i$ with log (base 10) of $i$x$i$
- ln replace stack $i$x$i$ with log (base e) of $i$x$i$
- 10^x replace stack $i$x$i$ with 10 raised to the $i$x$i$ power
- e^x replace stack $i$x$i$ with e raised to the $i$x$i$ power
- hrs convert hhmmss.s notation to decimal hours
- hms convert decimal hours to hhmmss.s notation
- index replace stack $i$x$i$ with 1,2,3,4,5...n
- ran replace stack $i$x$i$ with a random number (-1,1)
- max replace stack $i$x$i$ with the maximum of $i$x$i$
- min replace stack $i$x$i$ with the minimum of $i$x$i$
- mean replace stack $i$x$i$ with the mean of the $i$x$i$ vector
- sum replace stack $i$x$i$ with the sum of the $i$x$i$ vector
- rms replace stack $i$x$i$ with the root mean square of the $i$x$i$ vector
-
- ___ $i$Binary Operators$i$ _______________________________________________________
- The following operators pop stack $i$x$i$ and stack $i$y$i$ stack, calculate something and push the
- results of a calculation:
- + push y + x
- - push y - x
- / push y / x
- * push y * x
- y^x push y raised to the x power
- ________________________________________________________________________________
-
- You must separate operators and values in an $b$rpn$b$ expression with spaces. For
- example donàt use:
- rpn <x56 <y*
- use
- rpn <x 56 + <y *
- instead.
-
- If you need to calculate something using several different columns of your data file,
- remember that you can store intermediate results of your calculator on the calculator
- stack, in registers or any of the $i$x$i$, $i$y$i$, $i$e$i$ and $i$p$i$ vectors. In this way you can read some
- data, perform some calculations in $b$rpn$b$ leaving the results on the stack, read some
- more data and then finish the calculation. For example, to store the sum of columns 1
- through 3 of your data file divided by column 7, you could use the following commands:
-
- readcol x 1
- readcol y 2
- readcol e 3
- rpn <x <y <e + + % push all three vectors and add together
- readcol e 7 % read some more data into the e vector
- rpn <e / % divide the sum by the data in the e vector
- rpn >x % store the result in the x vector
- $$run
- [ scriptname ]
- Run the Recorder or some other script
-
- ARGUMENTS:
- scriptname ± the name of the script to run
-
- DESCRIPTION:
- Use $b$run$b$ to run script. If you donàt specify the name of the script, Asymptote runs
- the Recorder.
-
- If you specify the script to run, Asymptote searches for it automatically using the
- current $i$search paths$i$ file. You might create a directory with your favorite scripts and
- then add the path to that directory to your Search Paths file. Then, whenever you type
- the name of one of your scripts in the $i$Command Window$i$ or in a script, Asymptote opens
- and runs the script automatically.
-
- Remember, it is not necessary to use $b$run$b$ to run a script. Most scripts can be run by
- simply typing the script name as if it were an Asymptote command. In other words, the
- command
- run MyScript
- is the same as the command
- MyScript
- When Asymptote encounters a command thatàs not an Asymptote command, it assumes the
- command is the name of a script. Asymptote tries to locate a file with that name and run
- it. If there are spaces in the script name, however, you canàt type the script name as a
- command and must use the $b$run$b$ command instead. For example, you could run the
- script ¼Plot January Data½ with the command
- run Plot January Data
- but just typing
- Plot January Data
- produces an error because Asymptote tries to locate a script named ¼Plot½ and assumes
- that ¼January½ and ¼Data½ are the arguments to the command ¼Plot.½ Note that you
- could avoid this problem by naming the file ¼Plot_January_Data½ instead.
-
- PASSING ARGUMENTS TO SCRIPTS:
- You can pass arguments to a script by specifying the arguments after the script name.
- Use &n, where n is a number to denote the value of the nth argument. For example,
- if the script 'scaledata' contained the following commands:
- rpn <x &1 * >x
- rpn <y &2 * >y
- and you typed
- scaledata 2.3 34.9
- in the $i$Command Window$i$, Asymptote multiplies the $i$x$i$ vector by 2.3 and the $i$y$i$ vector by
- 34.9. You can also pass labels as arguments to scripts. If they include spaces,
- enclose them in quotes like this:
- addmylabels "March 12 run" "New atomic constants"
- You can also pass expressions as arguments to scripts if you also include them in quotes
- as in this example:
- scaledata "\npts 10 *" 34.9
- The first argument to the script 'scaledata' is the expression "\npts 10 *" (10 times the
- current number of points) and the value of the second argument is 34.9. When
- 'scaledata' runs, it scales the $i$x$i$ data by 10 times the number of points and
- the $i$y$i$ data by the constant 34.9.
-
- USING THE SEARCH PATHS FILE TO OPEN YOUR SCRIPT FILE AUTOMATICALLY:
- If Asymptote canàt locate a script for you automatically, make sure you have properly
- specified a search path to the file in the current paths file and that youàve spelled the
- name of the file correctly (including spaces). For help using the Search Paths file,
- see Appendix B of the $i$User's Guide$i$ or type
- help Search Paths
- in the $i$Command Window$i$.
-
- SPECIFYING THE FULL OR PARTIAL PATH NAME OF YOUR FILE:
- Itàs best to let Asymptote locate a file for you automatically by putting a path to the file
- in your Search Paths file. If you want to open a specific file in a specific directory, you
- can specify the full or partial path name of the file when you issue the $b$run$b$ command.
- Full path names start with a disk name (usually your hard disk name) and are followed
- by the name of each subfolder separated by colons and end with the name of the file. For
- example, to run the script "loaddata" in the folder "March 12" which is on the hard disk
- named "My Disk" you could use the following command:
- run My disk:March 12:loaddata
- Alternatively, if the folder "March 12" were in the same folder with Asymptote, you
- could use the partial path name:
- run :March 12:loaddata
- to run the script. Note that partial path names begin with a colon, while full path names
- do not. Partial path names always start their search starting with the folder that
- contains Asymptote.
-
- SEE ALSO:
- $i$search paths$i$
- $b$pause$b$ $b$stop$b$ $b$quit$b$
-
- EXAMPLES:
- % The following commands are three different ways to run the same script assuming
- % that the path
- % HardDisk:New Data:*
- % is in the current search path
- run myscript
- myscript
- HardDisk:New Data:myscript
- $$savegraph
-
- Save the current graph to a PICT file
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- The $b$savegraph$b$ command is the same as selecting File>Save Graph.
-
- SEE ALSO:
- $b$publish$b$
- $$scale
- factor
- Set the scale factor for labels, points and tickmarks
-
- ARGUMENTS:
- factor ± the scale factor
-
- DESCRIPTION:
- The $b$scale$b$ parameter of the $i$graphics environment$i$ controls the sizes of labels, points
- and the length of tickmarks and error bar caps. A scale factor of 1.0 draws points,
- labels and tick marks at their default size. You can change these defaults using
- $b$pointsize$b$ $b$fontsize$b$ and $b$ticksize$b$. If you donàt change the defaults, Asymptote
- uses 12 points for text and tick marks and 6 points for point symbols. With these
- defaults, if you set $b$scale$b$ to 2, Asymptote draws 24 point text and tick marks and 12
- point symbols.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$rotation$b$
- $b$drawframe$b$ $b$drawlabel$b$
- $b$drawxlabel$b$ $b$drawylabel$b$ $b$drawtitle$b$
- $b$plotpoints$b$ $b$drawpoint$b$
- $b$fontsize$b$ $b$ticksize$b$ $b$pointsize$b$
-
- EXAMPLES:
- scale 2.0
- drawlabel centerleft This label is twice as big
-
- scale 1
- drawtitle This is a 12˚pt title
-
- scale 1.2
- moveto .5 .5
- pointsymbol 5 star
- drawpoint
- scale scale 2 * % make the scale twice as big
- moveto .5 .5
- drawpoint
-
- readcolumn x 1
- readcolumn y 2
- graphlimits
- scale .75
- drawframe % draw a frame with reduced tickmarks
- pointsymbol 4 cross
- scale 1.0
- plotpoints % draw normalized points
- readcolumn y 3 % read some more y data
- scale 2.0
- plotpoints % draw these points twice as big
- $$set
- variablename expression
- Set the value of a variable
-
- ARGUMENTS:
- variablename ± the name of the variable to set
- expression ± an expression for the value to set
-
- DESCRIPTION:
- Use the $b$set$b$ command to alter the value of a variable. If the variable doesnàt exist,
- Asymptote creates a new one and sets its initial value.
-
- If you want to have the script ask the user (a technician, perhaps) to set the value of a
- user variable while it is running, replace the expression with a question mark followed
- by a prompt. The prompt is optional, so if you donàt supply one Asymptote supplies
- a prompt. For example, the command
- set myvar ?What should be the value for myvar?
- displays a dialog box that asks you to specify ¾myvar.à When Asymptote displays the
- dialog box, it uses the current value of the variable as the default expression. Thus, to
- change the default response simply set the variable first, then use $b$set$b$ again to ask
- for a new value. For example, the following commands
-
- set myvar 28.9
- set myvar ?What should be the value for myvar?
- ask you to set myvar after setting the default response to 28.9.
-
- If you use $b$set$b$ with a question mark prompt to define a variable that doesnàt exist,
- Asymptote displays an message asking if you want to create a new variable. This feature
- helps you avoid confusion due to misspelled variable names. To prevent Asymptote from
- asking if you want to create the variable, simply set the variable to some default value
- first, and then use the $b$set$b$ command with a question mark.
-
- SEE ALSO:
- $i$Variables and Constants$i$
- $b$rpn$b$
-
- EXAMPLES:
- set myvar x(10) 23 + % set 'myvar' to be x(10) plus 23
-
- set xyz npts 1 - % set 'xyzà = current number of points minus 1
-
- set count count 1 + % increment 'count' by 1
-
- set NumToDo 5 % Make 5 the default number of items to do
- set NumToDo ?How many items do you want to process?
- repeat NumToDo times process_another_item
- $$showgraph
-
- Zoom the $i$Graph Window$i$ to show the graph frame
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- The $b$showgraph$b$ command is the same as selecting Plot>Show˚Graph. Asymptote
- centers the frame in the $i$Graph Window$i$ by scrolling and zooming your graph. You can
- use $b$showgraph$b$ in a script to display the graph in the $i$Graph Window$i$.
-
- SEE ALSO:
- $b$showpage$b$ fullscreen
- $$showpage
-
- Zoom the $i$Graph Window$i$ to show the entire page
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- The $b$showpage$b$ command is the same as selecting Plot>Show˚Graph. Asymptote
- centers the page in the $i$Graph Window$i$ by scrolling and zooming your graph. You can use
- $b$showpage$b$ in a script to display the entire page in the $i$Graph Window$i$.
-
- SEE ALSO:
- $b$showgraph$b$ fullscreen
- $$showwindow
- [ windowName ]
- Make a window visible
-
- ARGUMENTS:
- windowName ± the name of the window to show
-
- DESCRIPTION:
- Use $b$showwindow$b$ to make a window visible after it was hidden with $b$hidewindow$b$.
- If you don't specify a window name, Asymptote makes the current window visible. You
- can use the command
- showwindow \f
- or
- showwindow \r
- to show the current data file and Recorder windows .
-
- EXAMPLES:
-
- showwindow test data % make the window 'test data' visible
-
- showwindow \f % Show the current data file window, whatever its name is
-
- hidewindow % hide this window
- ask junk "I, know" "Who cares?" ¼You can't see me!½
- showwindow % make this window visible again
- $$smooth
- width
- Smooth the y vector with a variable width window
-
- ARGUMENTS:
- width ± the width of the smoothing window
-
- DESCRIPTION:
- When you use $b$smooth$b$, Asymptote takes the Fast Fourier Transform (FFT) of the
- $i$y$i$ vector, smoothes it by a window with the width you specify (roughly the number
- of points to average), takes the inverse FFT and replaces the $i$y$i$ vector with the
- smoothed data. Another way to smooth your data is with the $b$spline$b$ command.
-
- EXAMPLES:
- readcolumn x 1
- readcolumn y 2
- graphlimits
- plotpoints % plot the unsmoothed data
- smooth 2.3
- plotline % plot a smoothed line
- $$sort
-
- Sort the y, e, p and l vectors by increasing x
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- When you issue the $b$sort$b$ command, Asymptote sorts the $i$y$i$, $i$e$i$, $i$p$i$, and $i$l$i$ vectors by
- ascending value of the $i$x$i$ vector. The calculator stack and its registers are unchanged.
-
- You can use $b$sort$b$ to sort the $i$x$i$ and $i$y$i$ points so they can be connected with a line
- that goes smoothly from left to right. In addition, some commands, like $b$spline$b$, only
- work on sorted data so you must use $b$sort$b$ before you can use them.
-
- EXAMPLES:
- readcolumn x 1
- readcolumn y 2
- sort
- plotline
- $$spline
- [ npts ]
- Calculate the natural cubic spline of y= f(x)
-
- ARGUMENTS:
- npts ± the number of points in the splined curve
-
- DESCRIPTION:
- Use $b$spline$b$ to calculate the natural cubic spline of the curve $i$y$i$ = f($i$x$i$). Asymptote
- replaces the $i$x$i$ and $i$y$i$ vectors with the calculated spline curve. You can specify, npts,
- the number of points in the spline. If you don't supply npts, $b$spline$b$ uses four times
- the current number of points for the spline curve. Asymptote distributes the points
- evenly from $i$xleft$i$ to $i$xright$i$.
-
- If the values in the $i$x$i$ vector are not in order, you must sort them first with the $b$sort$b$
- command before using $b$sort$b$.
-
- EXAMPLES:
- readcolumn x 1
- readcolumn y 2
- sort
- graphlimits % do this to set \xleft and \xright using the x vector data
- plotpoints
- spline 100 % calculate a spline of 100 points
- plotline % and plot it on top of the points
-
- graphlimits 10 12.3 0
- spline 25 % calculate a spline of 25 points running from x= 10 to 12.3
- $$stop
-
- Stop running the current script
-
- ARGUMENTS:
- none
-
- DESCRIPTION:
- Putting $b$stop$b$ in a script stops running the script. The $b$stop$b$ command is the same as
- selecting Script>Stop. But if you want to stop running a script $i$and$i$ quit Asymptote too,
- use $b$stop$b$.
-
- SEE ALSO:
- $b$quit$b$
- $b$pause$b$ $b$return$b$
-
- EXAMPLE:
- ask AllDone Yes No Do you want to stop running this script?
- $$textmode
- [ n ]
- Set the transfer mode for drawing text
-
- ARGUMENTS:
- n ± a mode number
- or
- ± a mode name(opaque, transparent, reversed)
-
- DESCRIPTION:
- Use $b$textmode$b$ to select a text drawing mode. Some constants have been defined to help
- you choose a mode, they are $i$opaque$i$, $i$transparent$i$, and $i$reversed$i$.
-
- To choose a mode graphically type:
- textmode ?
- to see an illustration.
-
- Keep in minds that most PostScript printers, including the LaserWriter, do not make
- use of text transfer modes. This is a feature of the LaserWriter driver supplied by
- Apple. Text modes are visible on QuickDraw based printers, however.
-
- SEE ALSO:
- $i$Variables and Constants$i$
- $b$fontname$b$ $b$scale$b$
- $b$penmode$b$ $b$pencolor$b$ $b$pensize$b$ $b$pendash$b$ $b$penpattern$b$
-
- EXAMPLES:
- moveto .5 .5
- fillpattern black
- pencolor black
- pointsymbol 4 filled
- scale 5
- drawpoint % draw a big black square
- scale 1.0
- moveto .5 .5
- textmode reversed
- drawlabel center This label is reversed
- $$ticksize
- points
- Set the default tick mark size
-
- ARGUMENTS:
- points ± tick mark size when scale = 1.0 (in points)
-
- DESCRIPTION:
- Use $b$ticksize$b$ to set the size (in points) that you want Asymptote to use tick marks
- when the scale factor is set to 1.0. The $b$ticksize$b$ command is a handy way to adjust
- the size of tickmarks without having to change $b$scale$b$ every time you draw axes.
- The default tick mark size is 12 points. You may want to add the $b$ticksize$b$
- command to your Start Up script if you want to change this default.
-
- SEE ALSO:
- $i$graphics environment$i$
- $b$drawframe$b$ $b$drawaxis$b$
-
- EXAMPLES:
- ticksize 10 % set the tick size to 10 points
- scale 1
- drawframe % draw 10 point tickmarks
- scale 2
- plotpoints % draw 20 pt tick marks
-
- $$while
- expression do command
- Execute a command or macro while an expression is true
-
- ARGUMENTS:
- expression ± a logical expression that evaluates to a true (1) or false (0) value
- command ± a command to execute while the expression remains true
-
- DESCRIPTION:
- Use $b$while$b$ to execute a command while a logical test is true. If the command is the
- name of a script, Asymptote executes script until the condition is false. Following the
- $b$while$b$ command you must supply the expression to evaluate, the word $i$do$i$ and
- the command you want Asymptote to execute.
-
- SEE ALSO:
- $b$repeat$b$ $b$if$b$
-
- EXAMPLES:
- while notfinished do mymacro % run 'mymacro' until \notfinished is false
-
- while x(1) 10 > do rpn <x 2 / >x % keep dividing x by 2 until x(1) is < 100
-
- $$zoomgraph
- [ factor ]
- Zoom the graph to display it either reduced or enlarged
-
- ARGUMENTS:
- factor ± the new graph zoom factor (>= 0)
- > 1 => zoom the graph to show it enlarged
- =1 => has no effect (ignored)
- < 1 => zoom the graph to show it reduced
- = 0 => same as clicking on the zoom box of the $i$Graph Window$i$
-
- DESCRIPTION:
- Use $b$zoomgraph$b$ to display the graph at a different scale or to zoom the Graph
- Window to fill the entire screen. Since $b$zoomgraph$b$ shrinks or expands the graph at
- the point in the center of the $i$Graph Window$i$, you may want to use
- $b$showgraph$b$ to center your graph first. Clicking the center of your graph with the
- magnify or demagnify cursors is exactly the same as the $b$zoomgraph$b$ command.
- With $b$zoomgraph$b$, however, you can specify exactly how much you want to expand
- or contract the graph. Remember that $b$zoomgraph$b$ does not change the scale of your
- graph or any of the variables of the $i$graphics environment$i$; it simply changes how the
- graph is displayed in the $i$Graph Window$i$.
-
- SEE ALSO:
- $b$showgraph$b$ $b$showpage$b$
- $b$fullscreen$b$
-
- EXAMPLES:
- showgraph % center the current graph frame in the $i$Graph Window$i$
- zoomgraph 2.5 % expand the graph to display it at
- % 2.5 times the current size
-
- zoomgraph % zoom the $i$Graph Window$i$ to fill the screen
- showpage % show the entire page in the window
- $$Reading data
- Using Asymptote
- Asymptote data files are ordinary 'TEXT' (ASCII) files. Unlike other Macintosh plotting
- programs, Asymptote does not 'import' your data into an internal file format that is
- unreadable by any other program. You donàt have to ¾importà your data every time your
- data file has changed. With Asymptote, you can be sure that what youàre plotting is
- up-to-date information.
-
- PUBLISH AND SUBSCRIBE:
- If you are using System 7, you can also use Publish and Subscribe to exchange data
- between Asymptote and other applications. With Publish and Subscribe, the changes
- you make to a document in one application are automatically updated in all other
- applications that ¾subscribeà to the data. For more information on how to use
- Publish and Subscribe with Asymptote, see Appendix˚E of the $i$Users Guide$i$.
-
- READING DATA:
- To read your data into Asymptote, first specify the file you want to read with the
- $b$datafile$b$ command. If you want to skip over a header at the top of your data file, or if
- you want to read only from certain lines or columns of the data file, issue the
- $b$datalines$b$ or $b$datacolumns$b$ commands. Finally, read the data from columns using
- $b$readcolumn$b$ or from rows using $b$readrow$b$. These commands store the values or
- labels you read in one of Asymptote's x, y, e, p or l vectors. Here is an example:
-
- datafile MyDataFile % Open the file "MyDataFile"
- datalines 3 % Skip the first two lines which are a header
- readcolumn x 1 % Read the values in column 1 into the x vector
- readcolumn y 3 % Read the values in column 3 into the y vector
- graphlimits % Find the limits of x and y
- drawframe % Draw a frame
- plotpoints % Plot the points
-
- FLEXIBLE FILE FORMAT:
- Asymptote looks for any number of spaces, a tab or a comma to distinguish items in
- a particular line of your data file. For example, the lines below have 6 columns each:
-
- 123 18.9 1E4.4 "Lot A" 0.0000234 99
- 124 19 1E4.5 "Lot A" 0.0000274 99
- 125 8 1E4.6 "Lot B" 0.0000232 99
- 126 23.4 1E4.3 "Lot B" 0.0000172 99
- 127 0 1E4.1 "Lot B" 0.0000984 99
-
- The columns could be separated by any number of spaces, tabs or a single comma. It's
- not necessary for the columns of your data file to be lined up in order to read the data
- into Asymptote. If the columns of your file are not separated this way, you can use
- $b$datacolumns$b$ to specify which characters to read from each line $i$before$i$ you
- read any data (see $b$datacolumns$b$ for more information). You can also use Asymptoteàs
- $i$Search$i$ and $i$Replace$i$ menus to reformat the text as necessary. To do a fancier search
- and replace, you can use the $i$GREP$i$ option in the ¼Find½ dialog box. See Appendix D
- of the $i$User's Guide$i$ for information on how to use GREP.
-
- READING LABELS:
- Normally your labels do not need to be enclosed in double quotation marks ("), but if
- you want to read labels that contain spaces, tabs or commas, you must enclose them
- in quotation marks. Use two double quotation marks in a row ("") to denote a quotation
- marks within a label.
- $$Startup script
- Using Asymptote
- The startup script is a special script Asymptote executes every time it starts up. You
- can use the startup script to change the default variables of the $i$graphics environment$i$.
-
- Make changes to the startup script when you want to reconfigure Asymptote to suit your
- needs. The startup script is just like any other script except that Asymptote runs it
- automatically when it starts up (unless you have turned this preference off). After
- the startup script runs, Asymptote records the state of the $i$graphics environment$i$.
- Later, when you select $i$Run˚Recorder$i$, Asymptote resets the variables of the
- $i$graphics environment$i$ to the values it had when the startup script finished running.
- In this way you can use the startup script to change the default values of various
- variables such as the font, graph frame, or pen size.
-
- In order for Asymptote to find the startup script, it must be named ¾Asymptote Startupà
- and it must be in the same folder with Asymptote. If you donàt have a startup script,
- you can create a new one by selecting File New to open a Text Editor Window. If you
- create a new startup script, be sure to name it ¾Asymptote Startupà and save it in the
- same folder as Asymptote. You can modify the startup script and make changes to it
- in a Text Editor Window.
-
- SEE ALSO:
- $i$graphics environment$i$
- $$Graphics Environment
- Using Asymptote
- Asymptote uses the current values of various parameters when it draws text, lines
- or points. These parameters are called the $i$graphics environment$i$. They are:
- scale ± sizes of points, labels and tick marks see: $b$scale$b$
- default: 1.0
- rotation ± rotation of points and labels (CCW in ¡) see: $b$rotation$b$
- default: 0.0
- fillpattern ± pattern for filling points and polygons see: $b$fillpattern$b$
- default: 1 (black)
- penpattern ± pattern for drawing lines see: $b$penpattern$b$
- default: 1 (black)
- pensize ± thickness of the pen when drawing lines see: $b$pensize$b$
- default: 1.0
- pencolor ± color of all graphics and text see: $b$pencolor$b$
- default: black
- pendash ± dash pattern to use when drawing lines see: $b$pendash$b$
- default: solid
- penmode ± transfer mode for graphics see: $b$penmode$b$
- default: 1 (opaque)
- textmode ± transfer mode for text see: $b$textmode$b$
- default: 1 (opaque)
- fontname ± font for labels see: $b$fontname$b$
- default: Times
- pointsymbol ± symbol to plot at each point see: $b$pointsymbol$b$
- default: 4 cross
-
- Before you issue a command that draws any graphics (i.e. lines, points or polygons)
- or labels make sure that the parameters of the graphics environment are set the way
- you want them to be set. Use the $i$Status Window$i$ to see what the current
- values are.
-
- You can change the default values of the $i$graphics environment$i$ using the $i$Startup Script$i$.
-
- SEE ALSO:
- $i$Startup Script$i$
- $$Variables & Constants
- Using Asymptote
- Variables and constants make it easier to enter commands and write scripts. There are
- two types of variables in Asymptote, user variables, which you define and control, and
- Asymptote variables, which Asymptote defines and controls. You can view the current
- values of all variables in the $i$Variables Window$i$. Constants are values set by
- Asymptote that never change. You use constants most often as the arguments to
- commands to make commands easier to read. Letàs take a look at how you can use
- variables and constants in your Asymptote scripts.
-
- $b$USER VARIABLES: ________________________________________$b$
- If you want to define your own variables, use the $b$set$b$ command. See the $b$set$b$ help page
- for more information.
-
- $b$ASYMPTOTE VARIABLES:____________________________________$b$
- When Asymptote starts up it creates a number of variables which you can use to make
- your commands and scripts more flexible. Many of these variables are variables of the
- $i$graphics environment$i$, such as the current size of the pen or the current position of
- the pen in graph coordinates. Other variables are the current number of points or the x
- and y limits of your graph. Asymptote automatically updates the values of these
- variables to reflect current conditions. For example, to move the pen to the lower left
- corner of the graph frame you could type the command
- moveto xleft ybottom
- which uses the variables xleft and ybottom, the x and y coordinates of the bottom left
- corner of the graph frame. The advantage or writing the moveto command this way is
- that it moves the pen to the lower left corner of the graph frame regardless of the limits
- of the graph.
-
- In another example, you could use the variable scale, to change the scale factor to twice
- its current value with the scale command as follows:
- scale scale 2 *
- Issuing the scale command this way has an advantage because no matter what the current
- scale factor is, the new scale factor will be twice as big. For example, you can use this
- command to draw a title on the graph twice the size of the tick mark labels. You can
- restore scale to its original value with the scale command as shown below:
- scale scale 2 /
-
- The following is a list of all Asymptote variables and the commands you can use to
- change their values.
- $b$Command$b$ $b$Value$b$
- x ± x position of the pen in graph coordinates
- y ± y position of the pen in graph coordinates
- gx ± x position of the pen in page coordinates
- gx ± y position of the pen in page coordinates
-
- xleft ± left side of graph (in graph coordinates) see: $b$graphlimits$b$
- xright ± right side of graph (in graph coordinates) see: $b$graphlimits$b$
- ybottom ± top of graph (in graph coordinates) see: $b$graphlimits$b$
- ytop ± bottom of graph (in graph coordinates) see: $b$graphlimits$b$
-
- gleft ± left side of graph (in page coordinates) see: $b$graphframe$b$
- gright ± right side of graph (in page coordinates) see: $b$graphframe$b$
- gbottom ± top of graph (in page coordinates) see: $b$graphframe$b$
- gtop ± bottom of graph (in page coordinates) see: $b$graphframe$b$
-
- pleft ± left edge of the page (in page coordinates) see: $b$graphframe$b$
- pright ± right edge of the page (in page coordinates) see: $b$graphframe$b$
- pbottom ± bottom of the page (in page coordinates) see: $b$graphframe$b$
- ptop ± top of the page (in page coordinates) see: $b$graphframe$b$
-
- npts ± current number of points see: $b$npts$b$
- scale ± maximum number of points see: $i$Memory Use$i$
-
- scale ± current scale factor see: $b$scale$b$
- rotation ± current rotation (in degrees) see: $b$rotation$b$
-
- pensize ± current pen size see: $b$pensize$b$
- penmode ± current pen transfer mode see: $b$penmode$b$
- penpattern ± current pen pattern number see: $b$penpattern$b$
- fillpattern ± current fill pattern number see: $b$fillpattern$b$
-
- startline ± current start line to read see: $b$datalines$b$
- endline ± current end line to read see: $b$datalines$b$
- startcolumn ± current starting column to read see: $b$datacolumns$b$
- endcolumn ± current end column to read see: $b$datacolumns$b$
-
- notation ± current notation format see: $b$notation$b$
- digits ± current number if significant digits see: $b$digits$b$
-
- $b$CONSTANTS:____________________________________________$b$
- When Asymptote starts up, it defines a number of constants for you. As mentioned
- above, you can't change a constant because they have special values that make typing
- script commands easier. For example, the single argument to fillpattern is a pattern
- number 0 through 38. To set the fill pattern to a light gray pattern, you could
- type the command like this:
- fillpattern 23
- Or, you could type the command using the constant lightgray, which Asymptote has set
- equal to 23. Using the constant, the command becomes
- fillpattern lightgray
- which is much easier to read and to remember.
-
- The following table lists all Asymptote constants and some examples of how
- you can use them in commands.
- $b$Name$b$ $b$Value$b$ $b$Example of Use$b$
- open 0 pointsymbol 4 open
- cross 1
- star 2
- filled 3
- belowleft 1 drawlabel belowleft This is a label
- below 2
- belowright 3
- centerleft 4
- center 5
- centerright 6
- aboveleft 7
- above 8
- aboveright 9
- bottom 1 drawaxis top line inside parallel nolabels
- left 2 drawframe parallel perpendicular nolabels
- top 3
- right 4
- ticks 1
- noticks 0
- inside 1
- outside 2
- line 1
- noline 0
- parallel 1
- perpendicular 2
- nolabels 0
- none 0 fillpattern none
- black 1 penpattern black
- darkgray 3
- gray 4
- lightgray 23
- white 20
- vertical 8
- horizontal 27
- diagonal 28
- squares 11
- bricks 12
- opaque 1 textmode opaque
- transparent 2 penmode transparent
- reversed 3
- erase 4
- inverted 5
- clear 6
- overlay 7
- whiteout 8
- solid 0 pendash solid
- dot 1 pendash dot long dot short
- short 4
- long 8
- decimal -2 notation decimal
- float -1
- general 0
- default 1
- scientific 2
- ddmmss 3
- hhmmss 4
- true, yes, on 1 fullscreen true
- false, no, off 0
- closed 1 plotpolygon closed
-